Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installing addons using hatch breaks Odoo installation #17

Closed
ivs-cetmix opened this issue Jun 4, 2024 · 10 comments
Closed

Installing addons using hatch breaks Odoo installation #17

ivs-cetmix opened this issue Jun 4, 2024 · 10 comments

Comments

@ivs-cetmix
Copy link

ivs-cetmix commented Jun 4, 2024

Not sure is this because of #12 because I have applied some patches from there however the issue still persists.

Steps to reproduce

Build image

Install Odoo from source in venv using git

Build is completed successfully with no issues.

Run container

Run container using docker-compose.yml

Expected behaviour

  • Postgres is up and running
  • Odoo is up and running

Current behaviour

  • Postgres is up and running
  • Odoo fails with error:
db-1   | 2024-06-04 20:53:01.438 UTC [59] LOG:  database system was shut down at 2024-06-04 20:53:01 UTC
db-1   | 2024-06-04 20:53:01.440 UTC [1] LOG:  database system is ready to accept connections
web-1  | Traceback (most recent call last):
web-1  |   File "/opt/odoo-venv/bin/odoo", line 8, in <module>
web-1  |     odoo.cli.main()
web-1  | AttributeError: module 'odoo' has no attribute 'cli'
web-1 exited with code 1

Notes

Same image runs fine if extra addons are not installed:

Steps to reproduce

  • Remove the part that installs third party addons using hatch-odoo
  • Rebuild the image
  • Run container

Result

  • Postgres is runnig
  • Odoo is running, all functions are working fine

Here are all the files used for build.

@sbidoul
Copy link
Member

sbidoul commented Jun 5, 2024

I released a fix for #12. Can you try again using https://github.com/acsone/hatch-odoo/blob/main/tests/data/project6/pyproject.toml as a template for your pyproject.toml?

If it persists, can you show me the result of python -c "import odoo; print(odoo.addons.__path__)".

@ivs-cetmix
Copy link
Author

Thank you very much @sbidoul !
Actually looks like it's not a hatch issue because after the update it's still the same error.

Here is the output if the command you mentioned:

0.583 AttributeError: module 'odoo' has no attribute 'addons'

@sbidoul
Copy link
Member

sbidoul commented Jun 5, 2024

Can you print odoo.__path__ and sys.path?

You may have more than one odoo directory in sys.path that contain a __init__.py.

@ivs-cetmix
Copy link
Author

Here is the output:

#25 [web 21/21] RUN python -c "import sys,odoo; print(odoo.__path__); print(sys.path)"
#25 0.152 + python -c 'import sys,odoo; print(odoo.__path__); print(sys.path)'
#25 0.245 _NamespacePath(['/opt/odoo-venv/lib/python3.10/site-packages/odoo', '/opt/extra-addons/build/__editable_odoo_addons__/odoo'])
#25 0.245 ['', '/usr/local/lib/python310.zip', '/usr/local/lib/python3.10', '/usr/local/lib/python3.10/lib-dynload', '/opt/odoo-venv/lib/python3.10/site-packages', '/opt/extra-addons/build/__editable_odoo_addons__']

Look like /opt/extra-addons/build/__editable_odoo_addons__/odoo is being added when third party addons are installed

@sbidoul
Copy link
Member

sbidoul commented Jun 5, 2024

Hm you have odoo in site-packages although you installed odoo in editable mode. That's not normal. What's in there?

@ivs-cetmix
Copy link
Author

Yup, really weird...

26 0.114 + ls -lha /opt/odoo-venv/lib/python3.10/site-packages/odoo
#26 0.139 total 12K
#26 0.139 drwxr-xr-x 3 root root 4.0K Jun  5 17:15 .
#26 0.139 drwxr-xr-x 1 root root 4.0K Jun  5 17:15 ..
#26 0.139 drwxr-xr-x 3 root root 4.0K Jun  5 17:15 addons

@ivs-cetmix
Copy link
Author

Wow!

#26 0.225 + ls -lha /opt/odoo-venv/lib/python3.10/site-packages/odoo/addons
#26 0.256 total 12K
#26 0.256 drwxr-xr-x  3 root root 4.0K Jun  5 17:15 .
#26 0.256 drwxr-xr-x  3 root root 4.0K Jun  5 17:15 ..
#26 0.256 drwxr-xr-x 15 root root 4.0K Jun  5 17:15 queue_job

@sbidoul
Copy link
Member

sbidoul commented Jun 5, 2024

That's normal. I suppose queue_job is a dependency (the only one?) of the addons you installed with hatch-odoo.

The question is: where did your Odoo install go?

@sbidoul
Copy link
Member

sbidoul commented Jun 6, 2024

Ok, I found the cause. You are hitting an Odoo / setuptools compatibility issue.

If you transform your odoo installation command to pip install -r /opt/odoo/requirements.txt -e /opt/odoo --config-setting=editable-mode=compat, it works. odoo/odoo#44001

@ivs-cetmix
Copy link
Author

Great! Thank you very much @sbidoul 👍
Everything is working as expected now. However this should be definitely solved at the Odoo level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants