I'm using Mac M1 and I'm having trouble opening Odoo. I try to run the command python3 odoo-bin --i base d db15 --limit-memory-hard 0 but it fails
File "/Users/simjiahong/odoo/odoo-bin", line 5, in <module>
import odoo
File "/Users/simjiahong/odoo/odoo/__init__.py", line 113, in <module>
from . import modules
File "/Users/simjiahong/odoo/odoo/modules/__init__.py", line 8, in <module>
from . import db, graph, loading, migration, module, registry
File "/Users/simjiahong/odoo/odoo/modules/graph.py", line 10, in <module>
import odoo.tools as tools
File "/Users/simjiahong/odoo/odoo/tools/__init__.py", line 21, in <module>
from .convert import *
File "/Users/simjiahong/odoo/odoo/tools/convert.py", line 33, in <module>
from odoo import SUPERUSER_ID, api
File "/Users/simjiahong/odoo/odoo/api.py", line 1024, in <module>
from odoo.modules.registry import Registry
File "/Users/simjiahong/odoo/odoo/modules/registry.py", line 21, in <module>
from odoo.sql_db import TestCursor
File "/Users/simjiahong/odoo/odoo/sql_db.py", line 21, in <module>
import psycopg2.extras
ModuleNotFoundError: No module named 'psycopg2.extras'```
Have you tried installing the psycopg2 python module?
I haven't used M1 Mac (or any Mac recently), but in general (Linux/Windows/Android) you can install python modules using the pip or pip3 command (whichever exists on your system). Like this:
pip3 install psycopg2
or:
pip install psycopg2
You might need root access to do this, or use the --user option, like:
pip3 install --user psycopg2
Also, you can use a similar command if you use a virtual environment inside that (venv, anaconda, etc.).
Related
I am facing this error every time I try to import pysftp in my training.py in the ml.azure.com pipelines. I am using Conda to create the environment for the workspace.
Traceback (most recent call last):
File "start_training.py", line 18, in <module>
import pysftp
File "/azureml-envs/azureml_8b4da5162aa2d3fe6990b8afc7945879/lib/python3.7/site-packages/pysftp/__init__.py", line 12, in <module>
import paramiko
File "/azureml-envs/azureml_8b4da5162aa2d3fe6990b8afc7945879/lib/python3.7/site-packages/paramiko/__init__.py", line 22, in <module>
from paramiko.transport import SecurityOptions, Transport
File "/azureml-envs/azureml_8b4da5162aa2d3fe6990b8afc7945879/lib/python3.7/site-packages/paramiko/transport.py", line 89, in <module>
from paramiko.dsskey import DSSKey
File "/azureml-envs/azureml_8b4da5162aa2d3fe6990b8afc7945879/lib/python3.7/site-packages/paramiko/dsskey.py", line 37, in <module>
from paramiko.pkey import PKey
File "/azureml-envs/azureml_8b4da5162aa2d3fe6990b8afc7945879/lib/python3.7/site-packages/paramiko/pkey.py", line 31, in <module>
import bcrypt
File "/azureml-envs/azureml_8b4da5162aa2d3fe6990b8afc7945879/lib/python3.7/site-packages/bcrypt/__init__.py", line 25, in <module>
from . import _bcrypt # type: ignore
ImportError: libffi.so.7: cannot open shared object file: No such file or directory
What I tried and failed:
I also tried to import the older version of pysftp which doesn't have dependency on libffi.so,
I tried with several versions of pysftp.
I tried installing the dependencies of pysftp.
I tried installing paramiko separately with current and older version.
I tried installing the bcrypt with current and older version.
I tried installing libffi.so with current and older version.
I tried creating new environments.
I tried by updating conda and pip also.
I tried to create simlink between libffi.so.6 and libffi.so.7 also.
So far, nothing works.
Help needed on this.
I'm aware of the -p flag, but whenever I use it to specify an interpreter, the resulting environment can't use pip. I want to use a python 3.x project and a python 2.7 project in the same application - as far as I know, the best way to do that is to install both interpreters with pyenv and make a virtual environment using virtualenv in each project folder, specifying the path to the correct interpreter. Here's what I did:
pyenv install 2.7.18
mkdir my_env
virtualenv -p ~/.pyenv/versions/2.7.18/bin/python my_env
source my_env/bin/activate
pip --version
and here's the output of pip --version (or anything involving pip):
Traceback (most recent call last):
File "/home/imageproc/my_env/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/imageproc/my_env/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/imageproc/my_env/lib/python2.7/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/imageproc/my_env/lib/python2.7/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/imageproc/my_env/lib/python2.7/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/home/imageproc/my_env/lib/python2.7/site-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
ImportError: No module named six
Similarly, if I do the above with a version of python 3.x installed by pyenv,
Traceback (most recent call last):
File "/home/imageproc/env3810/bin/pip", line 5, in <module>
from pip._internal.cli.main import main
File "/home/imageproc/env3810/lib/python3.8/site-packages/pip/_internal/cli/main.py", line 10, in <module>
from pip._internal.cli.autocompletion import autocomplete
File "/home/imageproc/env3810/lib/python3.8/site-packages/pip/_internal/cli/autocompletion.py", line 9, in <module>
from pip._internal.cli.main_parser import create_main_parser
File "/home/imageproc/env3810/lib/python3.8/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
from pip._internal.cli import cmdoptions
File "/home/imageproc/env3810/lib/python3.8/site-packages/pip/_internal/cli/cmdoptions.py", line 24, in <module>
from pip._internal.exceptions import CommandError
File "/home/imageproc/env3810/lib/python3.8/site-packages/pip/_internal/exceptions.py", line 10, in <module>
from pip._vendor.six import iteritems
ModuleNotFoundError: No module named 'pip._vendor.six'
It seems like this output could also be relevant, since a module is missing:
$ python -c "import sys
> for i in sys.path:
> print(i)"
~/my_env
~/.pyenv/versions/2.7.18/lib/python27.zip
~/.pyenv/versions/2.7.18/lib/python2.7
~/.pyenv/versions/2.7.18/lib/python2.7/plat-linux2
~/.pyenv/versions/2.7.18/lib/python2.7/lib-tk
~/.pyenv/versions/2.7.18/lib/python2.7/lib-old
~/.pyenv/versions/2.7.18/lib/python2.7/lib-dynload
~/my_env/lib/python2.7/site-packages
Pip works just fine, of course, when I use virtualenv as normal, e.g.
$ which python
/usr/bin/python
$ mkdir sys_env
$ virtualenv sys_env
$ source sys_env/bin/activate
$ pip --version
pip 20.0.2 from ~/sys_env/lib/python3.8/site-packages/pip (python 3.8)
and with that working, the path is
$ python -c "import sys
> for i in sys.path:
> print(i)"
~/sys_env
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
~/sys_env/lib/python3.8/site-packages
I don't quite know what I'm doing enough to find which part of the path the system python uses is missing for the pyenv-installed python or to figure out why it's missing.
I am trying to use a Python program written for Python 2.7. I am using a Macbook Pro running Catalina. The program is here: https://github.com/geoss/censumander. The program has two Jupyter Notebooks to practice with. I have Anaconda 4.9.2 installed and pip 20.2.4. When I open Jupyter Notebook it defaults to Python 3 and has no kernel option to change to Python 2. I have used the guide here to try to install the Python 2 kernel: https://ipython.readthedocs.io/en/latest/install/kernel_install.html.
When I run
python2 -m pip install ipykernel
I get back
Could not find a version that satisfies the requirement ipykernel (from versions: )
No matching distribution found for ipykernel.
I am pretty new to using Python (typically use R) and am trying to get the hang of stuff like this, so apologies if the answer here is obvious. I've tried the solutions here to no avail: Jupyter notebook with Python 2 and Python3 Kernel
I have also tried the solutions here: Jupyter Notebook - install python 2. The first solution
$ python2 /path/to/jupyter-notebook
is unclear to me as I don't understand to what file path the code points (for jupyter_notebook). (This is likely a consequence of my noobiness.)
The second,
conda create -n ipykernel_py2 python=2 ipykernel
conda activate ipykernel_py2
python -m ipykernel install --user
triggers the following traceback after the third line:
Traceback (most recent call last):
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/runpy.py", line 163, in _run_module_as_main
mod_name, _Error)
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/runpy.py", line 111, in _get_module_details
__import__(mod_name) # Do not catch exceptions initializing package
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/ipykernel/__init__.py", line 2, in <module>
from .connect import *
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/ipykernel/connect.py", line 13, in <module>
from IPython.core.profiledir import ProfileDir
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/__init__.py", line 49, in <module>
from .terminal.embed import embed
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/terminal/embed.py", line 18, in <module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 16, in <module>
from prompt_toolkit.document import Document
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/__init__.py", line 16, in <module>
from .interface import CommandLineInterface
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/interface.py", line 19, in <module>
from .application import Application, AbortAction
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/application.py", line 3, in <module>
from .buffer import Buffer, AcceptAction
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/buffer.py", line 7, in <module>
from .auto_suggest import AutoSuggest
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/auto_suggest.py", line 13, in <module>
from .filters import to_cli_filter
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/filters/__init__.py", line 33, in <module>
from .base import *
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/filters/base.py", line 5, in <module>
from prompt_toolkit.utils import test_callable_args
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/prompt_toolkit/utils.py", line 9, in <module>
from wcwidth import wcwidth
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/wcwidth/__init__.py", line 12, in <module>
from .wcwidth import ZERO_WIDTH # noqa
File "/opt/anaconda3/envs/ipykernel_py2/lib/python2.7/site-packages/wcwidth/wcwidth.py", line 79, in <module>
from backports.functools_lru_cache import lru_cache
ImportError: No module named functools_lru_cache
Thanks, all.
From version 5.0 ipykernel only runs on Python 3.4+ (from version 5.2 — 3.5+). To install ipykernel` for Python 2.7 you need an older version:
python2 -m pip install 'ipykernel<5.0'
For backports.functools-lru-cache install or force-reinstall it:
pip install -U backports.functools-lru-cache
or
pip install --ignore-installed backports.functools-lru-cache
I'm trying to execute ansible in my system. I guess I messed up something and unable to run ansible. When I run ansible --version, I see the following error:
krishnapatamset:bin krishna.patamsetti$ ansible --version
[WARNING]: log file at /var/log/ansible/ansible.log is not writeable and we cannot create it, aborting
ERROR! Unexpected Exception: No module named markupsafe
the full traceback was:
Traceback (most recent call last):
File "/usr/local/bin/ansible", line 80, in <module>
from ansible.cli.adhoc import AdHocCLI as mycli
File "/usr/local/lib/python2.7/site-packages/ansible/cli/adhoc.py", line 28, in <module>
from ansible.executor.task_queue_manager import TaskQueueManager
File "/usr/local/lib/python2.7/site-packages/ansible/executor/task_queue_manager.py", line 29, in <module>
from ansible.executor.play_iterator import PlayIterator
File "/usr/local/lib/python2.7/site-packages/ansible/executor/play_iterator.py", line 30, in <module>
from ansible.playbook.block import Block
File "/usr/local/lib/python2.7/site-packages/ansible/playbook/__init__.py", line 27, in <module>
from ansible.playbook.play import Play
File "/usr/local/lib/python2.7/site-packages/ansible/playbook/play.py", line 27, in <module>
from ansible.playbook.base import Base
File "/usr/local/lib/python2.7/site-packages/ansible/playbook/base.py", line 29, in <module>
from jinja2.exceptions import UndefinedError
File "/usr/local/lib/python2.7/site-packages/jinja2/__init__.py", line 33, in <module>
from jinja2.environment import Environment, Template
File "/usr/local/lib/python2.7/site-packages/jinja2/environment.py", line 13, in <module>
from jinja2 import nodes
File "/usr/local/lib/python2.7/site-packages/jinja2/nodes.py", line 19, in <module>
from jinja2.utils import Markup
File "/usr/local/lib/python2.7/site-packages/jinja2/utils.py", line 531, in <module>
from markupsafe import Markup, escape, soft_unicode
ImportError: No module named markupsafe
Can anyone please help me with this situation. Thanks in advance
I even tried pip install markupsafe but still I am unable to get ansible working
Ansible is based on python and there is a python module that's missing called markupsafe
install it via pip, you may need to escalate privileges
pip2 install -I markupsafe
pip2 for python 2.x
-I to ignore and reinstall package if it's already installed
I uninstalled pip and installed it again.
brew uninstall pip
brew doctor
brew install pip
Upgrade to 13.04 has totally messed my system up .
I am having this issue when running
./manage.py runserver
Traceback (most recent call last):
File "./manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
File "/home/rats/rats/local/lib/python2.7/site-packages/django/core/management
/__init__.py", line 4, in <module>
from optparse import OptionParser, NO_DEFAULT
File "/usr/lib/python2.7/optparse.py", line 77, in <module>
import textwrap
File "/usr/lib/python2.7/textwrap.py", line 10, in <module>
import string, re
File "/usr/lib/python2.7/string.py", line 83, in <module>
import re as _re
File "/home/rats/rats/lib/python2.7/re.py", line 105, in <module>
import sre_compile
File "/home/rats/rats/lib/python2.7/sre_compile.py", line 14, in <module>
import sre_parse
File "/home/rats/rats/lib/python2.7/sre_parse.py", line 17, in <module>
from sre_constants import *
File "/home/rats/rats/lib/python2.7/sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT
this is happening for both the real environment as well as for virtual environment .
i tried removing python with
sudo apt-get remove python
and sadly it has removed everything .
now google chrome does not show any fonts .
i am looking for getting things back to work .
help is needed for proper configuring it again.
If you are using virtualenvwrapper then you can recreate the virtualenv on top of the existing one (with no environment currently active):
mkvirtualenv <existing name>
which should pull in the latest (upgraded) python version from the system and fix any mismatch errors.
You don't need to recreate the environment.
You can upgrade the virtualenv running this command:
virtualenv /PATH/TO/YOUR_OLD_ENV
YOUR_OLD_ENV folder will be properly upgraded to the version 2.7.4.
I have just solved that problem on my machine.
The problem was that Ubuntu 13.04 use python 2.7.4. That makes conflict with the Python version of the virtualenv.
What I do was to re-create the virtualenv with the new version of python. I think it's the simplest way, but you can try to upgrade the python version without re-creating all of the virtualenv.