0

I'm following these instructions to install Odoo on Mac. It required that I install all the Python modules for the user like so:

sudo pip install -—user -r requirements.txt

(*A note about the --user part)

However, when I run Odoo, I get this error:

./odoo-bin

Output:

Traceback (most recent call last):
  File "./odoo-bin", line 5, in <module>
    __import__('pkg_resources').declare_namespace('odoo.addons')
  File "/Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg/pkg_resources/__init__.py", line 2241, in declare_namespace
  File "/Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg/pkg_resources/__init__.py", line 2257, in declare_namespace
  File "/Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg/pkg_resources/__init__.py", line 2192, in _handle_ns
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pkgutil.py", line 246, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/opt/odoo/odoo-10.0/odoo/__init__.py", line 64, in <module>
    import report
  File "/opt/odoo/odoo-10.0/odoo/report/__init__.py", line 5, in <module>
    from . import custom
  File "/opt/odoo/odoo-10.0/odoo/report/custom.py", line 20, in <module>
    from . import render
  File "/opt/odoo/odoo-10.0/odoo/report/render/__init__.py", line 4, in <module>
    from .simple import simple
  File "/opt/odoo/odoo-10.0/odoo/report/render/simple.py", line 8, in <module>
    import reportlab.lib
ImportError: No module named reportlab.lib

I noticed that this reportlab is available in requirements.txt:

reportlab==3.3.0

However, if I run this command

pip freeze | grep reportlab

I get nothing, but also when I run this command

sudo pip install --user reportlab

I get the following:

sudo pip install --user reportlab

Output:

The directory '/Users/odoo/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/odoo/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: reportlab in /Users/odoo/Library/Python/2.7/lib/python/site-packages
Requirement already satisfied: pillow>=2.4.0 in /Users/odoo/Library/Python/2.7/lib/python/site-packages (from reportlab)
Requirement already satisfied: pip>=1.4.1 in /Users/odoo/Library/Python/2.7/lib/python/site-packages (from reportlab)
Requirement already satisfied: setuptools>=2.2 in /Library/Python/2.7/site-packages/setuptools-36.5.0-py2.7.egg (from reportlab)
Requirement already satisfied: olefile in /Users/odoo/Library/Python/2.7/lib/python/site-packages (from pillow>=2.4.0->reportlab)

I have tried force reinstalling as suggested here, but that didn't do much.

How can I fix this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
abbood
  • 23,101
  • 16
  • 132
  • 246
  • pip install --upgrade --force-reinstall reportlab See https://stackoverflow.com/questions/38711221/installation-reportlab-importerror-no-module-named-reportlab-lib – Hammad Qureshi Sep 21 '17 at 07:45
  • that was the first thing i tried @HammadHQ.. will update question – abbood Sep 21 '17 at 07:46
  • Try again by providing the explicit python path in odoo configuration file – Hammad Qureshi Sep 21 '17 at 07:48
  • i cannot find instructions for that online (or any sample syntax).. can you help me with that? – abbood Sep 21 '17 at 07:53
  • i just realized taht i had python aliased to python3.. that may explain a bit of the problem – abbood Sep 21 '17 at 07:57
  • removed that, but still same problem – abbood Sep 21 '17 at 08:00
  • I faced the same issue some time ago. In my case, the problem is with the python env activate. I have restarted the server by providing full directory to my venv as: /home/odoo/odoo_env/python odoo.py .... – Hammad Qureshi Sep 21 '17 at 08:02
  • but i'm not using a virtual env step in the installation instructions.. can you provide me a link to your setup instructions? i agree having a virtual env is better than what i'm currently doing – abbood Sep 21 '17 at 08:03
  • You call `os base python version` but try install a module with `unsupported os level python version`, my opinion you call a module like this : `low_version python : from high_version_python import new_lib`. you broke `chronos` conditions. – dsgdfg Sep 21 '17 at 08:04
  • Ya right. My past experience says that running odoo in global python, will cause several issues like you face, specially when your have both python versions installed side by side. I suggest you to try to run odoo in python venv. – Hammad Qureshi Sep 21 '17 at 08:08
  • @dsgdfg can you please provide a reference to what you just said? I've never seen such syntax before.. – abbood Sep 21 '17 at 08:13
  • try to install `reportlab` with system tools(not with pip !), you show us `which module required for another module` not `os level` ! why ? `./blahblah` is os level command, your all files is correct ? On idle `import blahblah; blahblah.test()` will be work without any error ! Usage : `as a service` and `as a module` totally different thinks ! – dsgdfg Sep 21 '17 at 08:26
  • @dsgdfg how do i install it with system tools? i can't find any instructions for that online.. ie where it can be installed without using pip – abbood Sep 21 '17 at 09:40
  • I know it's an old question but can it be related to running `pip freeze` without `sudo`? – doneforaiur Jun 02 '23 at 21:02

1 Answers1

0

inspired by dsgdfg's comment.. I simply followed installation instructions here.. and it worked just fine

update

the above isn't much a solution, b/c i had to go back and install every library mentioned in requirements.txt manually!! i just created a virtual env and it ran without a hitch from first attempt!

abbood
  • 23,101
  • 16
  • 132
  • 246