Closed codingforfun closed 7 years ago
I think you are being hit by https://github.com/acsone/setuptools-odoo/issues/10
Could you try either
Let me know how it works.
I'm currently thinking about a more robust solution for v11 that would not involve namespace packages.
I did a quick test with your patch. Unfourtunately this didn't change anything.
To test your other proposal takes a bit more time, since I have to modifiy the parent container for this. I will try this next asap.
Hm, this import openerp as odoo
I see in the stack trace is something I never tested.
Note: This is a bit misleading. The core problem is, that import odoo
fails. The attempt to import openerp as odoo
is just a fallback for older odoo versions and has nothing to do with the problem itself. It's just symptom.
So the core problem is that odoo isn't installed properly / can't get imported although installed.
Here you can see what I mean: https://github.com/camptocamp/anthem/blob/master/anthem/cli.py#L17
I understand. This is annoying. So the only possibility I see is setuptools<31
or apply something similar to https://github.com/odoo/odoo/pull/15718 to any program that does import odoo
.
Note that merely doing pip install odoo10-addon...
should not cause issues because all such packages on pypi and wheelhouse.odoo-community.org are buillt with setuptools<31
.
I tried your suggestion. I pinned setuptools to 30.4.0 in the requirements file of the parent container, but unfortunately it didn't help.
I'm experimenting an alternative solution.
@codingforfun could you try running the following command after installing odoo and before running any program that does import odoo
?
pip install git+https://github.com/acsone/odoo-autodiscover@autopatch-sbi
Then run your programs normally. Don't worry about the scripts in odoo-autodiscover (they are not needed and are for odoo < 10 anyway).
In this branch I attempt a trick to apply https://github.com/odoo/odoo/pull/15718 transparently.
@sbidoul I can try this in the evening. I have another idea. Do you think the problem could also be the setup.py in the project? I took this over from camptocamp. The idea is to install the whole project as a package itself. After reading through packaging of namespace packages guide here I am wondering if I rather should install all the migration code for my project as a subpackage of odoo to solve the problem.
@sbidoul Your suggested solution is working. Thanks a lot. Can you help me to understand this better? I still don't got the problem completely.
What I think I got is:
__init__.py
to function properly.__init__.py
isn't run.
-e
option? Do you think it makes sense to isolate your hack with the post_import_hook
into a separate helper library?
Note to myself: This are the necessary changes: https://github.com/acsone/odoo-autodiscover/compare/autopatch-sbi
A minimal package for this workaround should contain:
@codingforfun this package is odoo-autodiscover
. I'll do a new release soon.
The rest of odoo-autodiscover
is for 8 and 9 but that's fine to have everything in the same package.
@codingforfun I've updated the odoo-autodiscover autopatch branch (https://github.com/acsone/odoo-autodiscover/pull/3). I intend to push a release candidate to pypi over the weekend.
@sbidoul This is great. Thanks a lot. I've worked with your current branch and had no problems so far.
Closing as duplicate of #10
@sbidoul I've seen you made the release. Thanks. Short question anyways:
Shouldn't there be an explicit version statement in setup.py instead of use_scm_version=True
? At least this was what you did for older releases.
That's the magic of setuptools-scm which computes the version automatically from the last git tag. So, with a little help from travis, making a release boils down to git tag && git push --tags
hy everyone, please can someone help me with the requirements in odoo 9 i did them but i heve pillow problem and python-ldap
@oussamaben18 sorry, this is not related to this project. This question is best asked on a generic Odoo support forum such as https://www.odoo.com/forum/help-1.
This is a bit special problem but maybe also relevant for your project. I tried to integrate your approach of installing Odoo addons via pip into the docker-odoo-project from camptocamp.
The following problems arise: Odoo is installed from source via
pip install -e
. After this modules are installed via arequirements.txt
file in the project. Modules requiring Odoo as a dependency (like all modules fromhttps://wheelhouse.odoo-community.org/
) somehow breakimport odoo
statements in following scripts.I don't really understand the problem, but I was able to temporarily solve this by manually removing the corresponding
nspkg.pth
files from dist-packages. I assume it has to do withnamespace_packages: ['odoo', 'odoo.addons']
in setup.py.I reported the problem here: https://github.com/camptocamp/docker-odoo-project/issues/38
A minimal example can be found here: https://github.com/codingforfun/test-odoo-project/tree/pip-issue
I think integrating the docker approach with the approach of installing Odoo modules from PIP would be really a great thing, so any pointer you have to solve the problem would be very appreciated since I'm unfortunately not that firm with python packaging details.