Traceback (most recent call last): File "./odoo-bin", line 5, in <module> - ubuntu-18.04

Traceback (most recent call last):
File "./odoo-bin", line 5, in
import odoo
File "/opt/odoo/odoo/odoo/init.py", line 73, in
import babel
ModuleNotFoundError: No module named 'babel'

In Odoo should install first all requirements
Navigate to your project folder then try to run this command in terminal
pip install -r requirements.txt
If get any error while this command execution, resolve that errors then only Odoo server work.

If you use multi version of python
Check version:
python --version
e.g For me: Python 3.7.7
py -3.7 -m pip install -r requirements.txt

Related

Error when running pip install discord.py

I am on a mac OS with python 3.5.3
I am completely new to python.
This is the command line when I try to run pip install discord.py
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/setup.py'"'"'; __file__='"'"'/private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-pip-egg-info-Zb_d0r
cwd: /private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/7k/_5tkn2z940bfbjwc6jxhdvb40000gp/T/pip-install-HvXx9C/aiohttp/setup.py", line 60, in <module>
raise RuntimeError("aiohttp requires Python 3.4.2+")
RuntimeError: aiohttp requires Python 3.4.2+
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
This is because your pip command is pointing to Python 2. discord.py requires Python 3.4.2 or higher. Try using:
pip3 install discord.py

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

gcloud installation permission issue on Ubuntu 12.04

I have installed PHP App Engine SDK first. Then, I installed Google Cloud SDK using:
sudo curl https://sdk.cloud.google.com | bash
but it's showing error while installing.
Then, I installed Google Cloud SDK from a zip file, but it shows an error at the final stage of installation:
/home/nikhil/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/install.py", line 20, in <module>
from googlecloudsdk.gcloud import gcloud
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.03'
What should I do to complete installation?
Then, I tried gcloud info on terminal, but it's showing the error below:
nikhil#nikhil-Aspire-S3-391:~$ gcloud info
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.04'
This looks like a file permissions error in creating the directory /home/nikhil/.config/gcloud/logs/2015.07.04. Can you check the existence and file permissions for all of the parent directories?
ls -ld /home/nikhil/
ls -ld /home/nikhil/.config
ls -ld /home/nikhil/.config/gcloud
ls -ld /home/nikhil/.config/gcloud/logs
ls -ld /home/nikhil/.config/gcloud/logs/2015.07.04
Then upload the output to this question.
My hunch is that you've run a Cloud SDK command as the root user (generally not recommended), which created the /home/nikhil/.config/gcloud directory with root as the owner. If this is the case, the command:
sudo chown -R nikhil /home/nikhil/.config/gcloud
may fix the issue.
As an aside, the command sudo curl https://sdk.cloud.google.com | bash will not do what you want it to do; it executes curl as root, but the actual install will not happen as the root user. The Cloud SDK can be installed without root privileges, so I recommend simply curl https://sdk.cloud.google.com | bash.

Jenkins gcloud deployment causes ImportError

I've set up a Jenkins instance in Google Compute Engine to build and deploy an App Engine Java project following this page from Google.
I've configured Jenkins to run the following shell command only when the Maven build succeeds: gcloud --project=decent-ellipse-843 preview app deploy target/*-SNAPSHOT/
When I attempt a build, the deployment fails with the following trace:
+ gcloud --project=decent-ellipse-843 preview app deploy target/backend-api-0.0.1-SNAPSHOT/
Traceback (most recent call last):
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 183, in <module>
main()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 179, in main
_cli.Execute()
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 488, in Execute
post_run_hooks=self.__post_run_hooks)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py", line 1016, in Run
result = command_instance.Run(args)
File "/usr/local/bin/../share/google/google-cloud-sdk/./lib/googlecloudsdk/calliope/exceptions.py", line 86, in TryFunc
return func(*args, **kwargs)
File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 158, in Run
stage_dir = self.__MakeStagingDir(project, args, deployable)
File "/usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/deploy.py", line 268, in __MakeStagingDir
java_app_update = appcfg_java.JavaAppUpdate(deployable, args)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 146, in __init__
self.app_engine_web_xml = self._ReadAppEngineWebXml()
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 205, in _ReadAppEngineWebXml
parser=app_engine_web_xml_parser.AppEngineWebXmlParser)
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/appcfg_java.py", line 217, in _ReadAndParseXml
return parser().ProcessXml(file_handle.read())
File "/usr/local/share/google/google-cloud-sdk/platform/google_appengine/google/appengine/tools/app_engine_web_xml_parser.py", line 71, in ProcessXml
xml_root = ElementTree.fromstring(xml_str)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1300, in XML
parser = XMLParser(target=TreeBuilder())
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1466, in __init__
"No module named expat; use SimpleXMLTreeBuilder instead"
ImportError: No module named expat; use SimpleXMLTreeBuilder instead
Build step 'Execute shell' marked build as failure
Finished: FAILURE
The Maven build is successful, and I can deploy the project by issuing the gcloud command manually.
Even when I run the exact same gcloud command from the same directory and under the same user (tomcat), the deployment succeeds without errors.
I have re-installed python and updated the Google Cloud SDK without any results.
The instance is running Python 2.7.3, Jenkins 1.598, JDK 7u76 and Maven 3.2.2.
I hope someone can help me out with this!
I ran into a similar issue running my jobs on the cloud-dev-python slave. The images are missing build tools that you may need in order to build and deploy properly. My solution was to connect to the docker image and install the tools manually the first time around.
# on docker host, connect to java image
CONTAINER_ID=$(docker ps | grep cloud-dev-java | awk '{print $1}');
docker exec -i -t $CONTAINER_ID bash
# on docker image, install crap to build lxml, etc
gcloud -q components update preview app && apt-get update \
&& apt-get install -y build-essential libz-dev libxml2-dev \
libxslt1-dev python-dev python-pip && apt-get autoremove
Give that a whirl and see if it helps. I'm currently stuck with the service account not authenticating even though it is set up properly...

Google App Engine interactive console using the Terminal

Following instructions on this page, Accessing the datastore remotely with remote_api:
I edited app.yaml to include these lines:
builtins:
- remote_api: on
I opened up a Terminal:
$ cd /path/to/app
$ python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s localhost:8082 -p /_ah/remote_api
At the root of my app folder structure, I have a module named foobar.py, as well as a package named data_models. After gaining access to the remote_api Python interpreter, I try the following lines:
import foobar
import data_models
But I get an error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named foobar
Traceback (most recent call last):
File "<console>", line 1, in <module>
ImportError: No module named data_models
How do I access the interactive console through the Terminal? Am I missing something? The same thing happens even if I login to the cloud server:
$ python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s my-app.appspot.com -p /_ah/remote_api
remote_api just makes it possible to make RPC calls from a local task to a remote instance of an App Engine app. The Python console itself is still local, and everything you do executes locally. That means that any modules you try and import must exist on your local machine, somewhere your Python instance can find them - probably by adding your app's directory to PYTHONPATH, like this:
$ PYTHONPATH=/my/app/dir python2.5 /usr/local/google_appengine/remote_api.shell.py\
-s my-app.appspot.com -p /_ah/remote_api
I added the following lines to my .bash_profile so that I won't have to edit PYTHONPATH every time I fire up the Terminal.
PYTHONPATH = "/path/to/app"
export PYTHONPATH
It seems that the remote_api is in a different path than your app so it curpwd is that of the remote_api so your app's code is not available

Resources