Syntax Error in google-api-python-client - google-app-engine

While attempting to follow the Appengine quickstart the following error message appears:
httplib2/__init__.py", line 352
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax

I had the same issue but my solution was to run pip in a virtual environment for the correct Python version, in my case it was 2.7.
virtualenv --python=python2.7 .venv27
source .venv27/bin/activate
pip2.7 install -r requirements.txt -t lib

When installing google-api-python-client, the following is recommended:
pip install -t lib google-api-python-client
If this command is used in an enviornment running python 3, the lib installed copy will fail.
Better to explicily state pip2:
pip2 install -t lib google-api-python-client

Related

wxPython Installation failure

I am trying to install wxPython on a new installation of Ubuntu 18.04 using the command
pip3 install wxPython
The build fails with
error: [Errno 2] No such file or directory: 'build/lib.linux-x86_64-3.6/wx/libwx_baseu-3.0.so'
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-30uqzd2e/wxPython/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-hynl659w-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-30uqzd2e/wxPython/
I have no idea where to look for a solution. Can someone please suggest where I might start
[EDIT 20200424 08:06]
I looked in
/usr/lib/x86_64-linux-gnu/
and
libwx_baseu-3.0.so.0
was absent. I have installed it from this site
It is now present, but the install fails with the same message
I have managed to install wxPython.
I reinstalled Ubuntu 18.04 and performed the following:
sudo apt install make gcc libgtk-3-dev libwebkitgtk-dev libwebkitgtk-3.0-dev libgstreamer-gl1.0-0 freeglut3 freeglut3-dev python-gst-1.0 python3-gst-1.0 libglib2.0-dev ubuntu-restricted-extras libgstreamer-plugins-base1.0-dev
pip3 install wxpython
I guess that when it was failing I had tried many fixes and somewhere along the line something was corrupted or there was a mismatch somewhere.
My solution was based on this answer
I Installed wx.python 4.1.0 yesterday with:
URL=https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-18.04
pip install -U -f $URL wxPython
See: https://extras.wxpython.org/wxPython4/extras/ for details.
For gtk3 simply replace gtk2 in the url above.

Installing TinyTeX in a Singularity container

I'm writing a paper in RMarkdown and for better reproducibility, I want to containerize all required software in a singularity container. Unfortunately, when I try to install TinyTeX (which is recommended for Rmarkdown and I would prefer over TeXLive to not inflate the container more than needed), it fails with the following error message (the full build log is pasted here):
Can't locate TeXLive/TLConfig.pm in #INC (you may need to install the TeXLive::TLConfig module) (#INC contains: /~/.TinyTeX/texmf-dist/scripts/texlive /~/.TinyTeX/tlpkg /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at ~/.TinyTeX/bin/x86_64-linux/tlmgr line 100.
BEGIN failed--compilation aborted at ~/.TinyTeX/bin/x86_64-linux/tlmgr line 100.
This is the build definition file, basically it uses a very slimmed down ubuntu 18.04 and then executes the %post section to install software
BootStrap: library
From: ubuntu:18.04
%post
# Add universe repository
echo "deb http://us.archive.ubuntu.com/ubuntu bionic universe" >> /etc/apt/sources.list
apt -y update
# Install utilites
apt install -y wget
# Install R
apt install -y r-base-core
## Install RMarkdown and TinyTeX
R --slave -e 'install.packages(c("rmarkdown","tinytex")); tinytex::install_tinytex()'
# Clean
apt-get clean
%environment
export LC_ALL="en_US.UTF-8"
%labels
Author DP
I have also tried tinytex::install_tinytex(dir="/opt/tinytex") but that didn't seem to change anything. Does anyone have an idea what's wrong?
That error message is complaining that your image (or, more likely, your path) is missing the TeXLive::TLConfig perl module.
My guess is that the path contents are not being rehashed with the installed modules after the install. The simplest solution is to break it into two commands:
R --slave -e 'install.packages(c("rmarkdown","tinytex"))'
R --slave -e 'tinytex::install_tinytex()'
Installation succeeds when I try that locally.
A potentially useful alternative, if the image is just for document generation, could be converting a docker image with rmarkdown and tex (e.g. https://hub.docker.com/r/rocker/verse) to a singularity one.
With singularity pull docker://rocker/verse you can do that for the latest version, or for a specific version with verse:version_number.

Apache start libphp7.3.so not found

I have Install php 7.3 and apache2 but when I try to start apache2 , I have this error :
service apache2 start
apache2: Syntax error on line 146 of /etc/apache2/apache2.conf: Syntax error on line 3 of /etc/apache2/mods-enabled/php7.3.load: Cannot load /usr/lib/apache2/modules/libphp7.3.so into server: /usr/lib/apache2/modules/libphp7.3.so: cannot open shared object file: No such file or directory
I really don't know how to resolve this problem, I have tried to remove and reinstall without success.
You're getting that error because the PHP 7.3 library for Apache is not installed.
sudo apt install -y libapache2-mod-php7.3
The above command should fix it.
It solved my problem:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.3
sudo apt-get install php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-mysql php7.3-mbstring php7.3-zip php7.3-fpm php7.3-intl php7.3-simplexml
sudo service apache2 restart
For me the problem was that I did not install apache tools for php.
On arch linux:
yaourt -S php-apache
After that, module appeared in the folder.
The best way not to make a mistake is to follow guide: https://wiki.archlinux.org/title/Apache_HTTP_Server#PHP

Cannot pip install SolrClient (python2.6 vs 3.4 issues?)

I am trying to pip install SolrClient, and I believe I am having some difficulty with my version of python.
Here is the error message.
[root#centos64 ~]# pip install SolrClient
DEPRECATION: Python 2.6 is no longer supported by the Python core team, please upgrade your Python. A future version of pip will drop support for Python 2.6
Collecting SolrClient
Using cached SolrClient-0.1.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-UeQsqQ/SolrClient/setup.py", line 4, in <module>
import SolrClient
File "SolrClient/__init__.py", line 1, in <module>
from .solrclient import SolrClient
File "SolrClient/solrclient.py", line 10, in <module>
from .collections import Collections
File "SolrClient/collections.py", line 7, in <module>
from collections import defaultdict
ImportError: cannot import name defaultdict
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-UeQsqQ/SolrClient/
So, when I go to check my python version, it is 2.6
[root#centos64 ~]# python -V
Python 2.6.6
I've got python 3.4 on my machine, albeit I need to call it like this
[root#centos64 ~]# python3.4 -V
Python 3.4.3
So, a few questions.
Am I correct in my assumption that my error is due to the fact that I am attempting to pip install using python2.6?
If so, how do I either
a) tell pip to use the python3.4 version? (not sure if this is the right way of thinking about it)
b) adjust my system to use python3.4
Otherwise, I am not sure how to proceed here. Thoughts?
I did indeed need to use python3.4
As suggested, I went with a virtual environment for the task.
pip install pew
pew new -p `which python3.4` 3.4
pew workon 3.4
pip install SolrClient
sudo apt install virtualenv
virtualenv -p python3 <envname>
cd <envname>
source bin/activate
pip install SolrClient

error: import pychart , during install source code odoo 9.0

I wrote so many thing in requirements.txt and reinstalled but it didn't work out. I installed odoo 9.0 source code for windows. The command prompt is showing error:
from pychart import *
What do I need to write in requirements.txt for pychart?
As i just ran into the same problem unrelated to odoo.
The following command solved it for me:
pip install Python-Chart
To install the python packages for odoo you can use below command found from this detailed odoo install guide
cd /tmp && wget https://raw.githubusercontent.com/odoo/odoo/9.0/requirements.txt && sudo pip install -r requirements.txt
It will install all the python dependacy in just one command.
Hope this helps.
You have to install that package before you use that, If are on ubuntu command is pip install pychart and if you are on windows the command is c:\Python27\Scripts\pip.exe install pychart.I assume you have installed python on default folder c drive.
Why don't you create a module like install_module and on depends you can add required list of module to install. If you install that module it'll automatically install all depended module. I'm using this same. Instead of command prompt it'll be quite easy too. You can view the depends module list in Technical Data of that install_modules.
I Hope it'll be helpful.

Resources