-
Notifications
You must be signed in to change notification settings - Fork 154
Description
I tried to integrate the OCA approach of installing Odoo addons via pip instead of importing external source repositories.
More about this can be found here and here.
Also I prepared a minimal example based on https://github.com/camptocamp/test-odoo-project demonstrating this for the example of installing disable_odoo_online
from OCA server-tools here: camptocamp/test-odoo-project@master...codingforfun:pip-issue
https://github.com/codingforfun/test-odoo-project/tree/pip-issue
I run into the problem that anthem isn't finding odoo anymore if requirements from requirements.txt inside the child container contain dependencies to Odoo.
The reason seams to be that Odoo gets installed in the parent container with 'pip install -e'.
I did some research but don't have any conclusion yet and hope you maybe have an idea. It seams to have something to do with namespace packages. Pip packaged Odoo modules adds namespace_packages: ['odoo', 'odoo.addons']
inside setup.py for the module.
I was able to run anthem inside the container again after removal of the corresponding nspkg.pth from dist-packages.
Some relevant references I found:
- pip install --editable and pip install clash for namespace packages pypa/pip#3
- [ADD] oca-bdist-all-wheels OCA/maintainer-tools#156
- https://github.com/acsone/setuptools-odoo
The error log I get from docker-compose up --build
:
[...]
Step 1/1 : RUN cd /opt/odoo && pip install -r src_requirements.txt
---> Running in c5f7fb4b75ee
Obtaining file:///opt/odoo (from -r src_requirements.txt (line 7))
Obtaining file:///opt/odoo/src (from -r src_requirements.txt (line 8))
Requirement already satisfied: babel>=1.0 in /usr/local/lib/python2.7/dist-packages (from odoo==10.0->-r src_requirements.txt (line 8))
[...]
Requirement already satisfied: python-stdnum in /usr/local/lib/python2.7/dist-packages (from vatnumber->odoo==10.0->-r src_requirements.txt (line 8))
Installing collected packages: test-odoo-project, odoo
Running setup.py develop for test-odoo-project
Running setup.py develop for odoo
Successfully installed odoo test-odoo-project
---> 6625234dcd4b
[...]
Step 4/5 : RUN cd /opt/odoo && find . -maxdepth 1 -name "*requirements.txt" ! -name src_requirements.txt ! -name base_requirements.txt -exec pip install --extra-index-url=https://wheelhouse.odoo-community.org/oca-simple -r {} \;
---> Running in d8d69d9a0631
Collecting odoo10-addon-disable-odoo-online (from -r ./requirements.txt (line 2))
Downloading odoo10_addon_disable_odoo_online-10.0.1.0.0-py2-none-any.whl
Requirement already satisfied: odoo<10.1dev,>=10.0 in ./src (from odoo10-addon-disable-odoo-online->-r ./requirements.txt (line 2))
Requirement already satisfied: babel>=1.0 in /usr/local/lib/python2.7/dist-packages (from odoo<10.1dev,>=10.0->odoo10-addon-disable-odoo-online->-r ./requirements.txt (line 2))
[...]
Requirement already satisfied: python-stdnum in /usr/local/lib/python2.7/dist-packages (from vatnumber->odoo<10.1dev,>=10.0->odoo10-addon-disable-odoo-online->-r ./requirements.txt (line 2))
Installing collected packages: odoo10-addon-disable-odoo-online
Successfully installed odoo10-addon-disable-odoo-online-10.0.1.0.0
---> 90257035d29e
[...]
odoo_1 | |> migration: processing version 10.0.0
odoo_1 | |> version 10.0.0: start
odoo_1 | |> version 10.0.0: execute base pre-operations
odoo_1 | |> version 10.0.0: anthem songs.install.pre::main
odoo_1 | Traceback (most recent call last):
odoo_1 | File "/usr/local/bin/anthem", line 7, in <module>
odoo_1 | from anthem.cli import main
odoo_1 | File "/usr/local/lib/python2.7/dist-packages/anthem/cli.py", line 22, in <module>
odoo_1 | import openerp as odoo # noqa
odoo_1 | ImportError: No module named openerp
odoo_1 | Traceback (most recent call last):
odoo_1 | File "/usr/local/bin/marabunta", line 11, in <module>
odoo_1 | sys.exit(main())
odoo_1 | File "/usr/local/lib/python2.7/dist-packages/marabunta/core.py", line 126, in main
odoo_1 | migrate(config)
odoo_1 | File "/usr/local/lib/python2.7/dist-packages/marabunta/core.py", line 115, in migrate
odoo_1 | runner.perform()
odoo_1 | File "/usr/local/lib/python2.7/dist-packages/marabunta/runner.py", line 85, in perform
odoo_1 | VersionRunner(self, version).perform()
odoo_1 | File "/usr/local/lib/python2.7/dist-packages/marabunta/runner.py", line 143, in perform
odoo_1 | operation.execute(self.log)
odoo_1 | File "/usr/local/lib/python2.7/dist-packages/marabunta/model.py", line 259, in execute
odoo_1 | self._execute(log, interactive=sys.stdout.isatty())
odoo_1 | File "/usr/local/lib/python2.7/dist-packages/marabunta/model.py", line 246, in _execute
odoo_1 | child.exitstatus
odoo_1 | marabunta.exception.OperationError: command 'anthem songs.install.pre::main' returned 1
testodooproject_odoo_1 exited with code 1
[...]