current trunk (8.0alpha1) requires module requests otherwise web won't load

Bug #1205920 reported by Brad Clements
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP buildout recipe
Won't Fix
Undecided
Unassigned

Bug Description

see attached buildout.cfg

without eggs = including requests, web client would install in addons path but fail to start with error shown below:

2013-07-28 21:40:54,086 19493 CRITICAL ? openerp.modules.module: Couldn't load module web
2013-07-28 21:40:54,086 19493 CRITICAL ? openerp.modules.module: No module named requests
2013-07-28 21:40:54,086 19493 ERROR ? openerp.service: Failed to load server-wide module `web`.
The `web` module is provided by the addons found in the `openerp-web` project.
Maybe you forgot to add those addons in your addons_path configuration.
Traceback (most recent call last):
  File "/home/bkc/src/eclipse/main/openerp-buildout/parts/openerp-trunk/openerp/service/__init__.py", line 63, in load_server_wide_modules
    openerp.modules.module.load_openerp_module(m)
  File "/home/bkc/src/eclipse/main/openerp-buildout/parts/openerp-trunk/openerp/modules/module.py", line 357, in load_openerp_module
    getattr(sys.modules['openerp.addons.' + module_name], info['post_load'])()
  File "/home/bkc/src/eclipse/main/openerp-buildout/openerp-web/addons/web/http.py", line 1105, in wsgi_postload
    root = Root()
  File "/home/bkc/src/eclipse/main/openerp-buildout/openerp-web/addons/web/http.py", line 857, in __init__
    self.load_addons()
  File "/home/bkc/src/eclipse/main/openerp-buildout/openerp-web/addons/web/http.py", line 964, in load_addons
    m = __import__('openerp.addons.' + module)
  File "/home/bkc/src/eclipse/main/openerp-buildout/parts/openerp-trunk/openerp/modules/module.py", line 83, in load_module
    mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)
  File "/home/bkc/src/eclipse/main/openerp-buildout/openerp-addons/google_spreadsheet/__init__.py", line 1, in <module>
    import google_spreadsheet
  File "/home/bkc/src/eclipse/main/openerp-buildout/openerp-addons/google_spreadsheet/google_spreadsheet.py", line 24, in <module>
    import requests
ImportError: No module named requests

I am a buildout newbie, so I am unsure if 'requests' is supposed to go into the anybox recipe or should be mentioned in the readme as a requirement for 8.x trunk

thanks

Revision history for this message
Brad Clements (bkc) wrote :
Revision history for this message
Georges Racinet (gracinet) wrote :

Thanks for the report !

Indeed, this can also be seen in the buildbot https://buildbot.anybox.fr/builders/openerp-trunk-postgresql-9.1/builds/2112

This is due to a recent changeset in OpenERP.
We could correct this in the recipe, and that wouldn't be the only dependency that's added/corrected to OpenERP's setup.py
But I wonder why they didn't add it to setup.py in the first place.
If they simply forgot about it, then the issue will solve itself once their setup.py gets corrected.
But maybe they don't want to add the requiremet in there, because that's a need of the 'web' addon, not of openobject-server.
In that case, I'd be glad to add a condition in the recipe

We should ask them

There's no clean way that I know of to indicate that an addon has a requirement on a python library (that's really missed)

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> But maybe they don't want to add the requiremet in there, because that's a need of the 'web' addon

It's got nothing to do with the `web` module, requests is imported by the `google_spreadsheet` module.

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> There's no clean way that I know of to indicate that an addon has a requirement on a python library (that's really missed)

That is, sadly, correct.

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

(sorry for the spam, but looking at the code there really is no reason to use requests anyway. It's used for a single POST, urllib2 would do the job just about as nicely)

Revision history for this message
Georges Racinet (gracinet) wrote :

Hi Xavier,

your feedback is very welcome.

Shall we fill a bug report on openerp-addons, then ?

Revision history for this message
Florent Aide (florent-aide) wrote :

There is a way to declare a direct dependency on an external python lib in an openerp module.

Just add the following code to your module's __openerp__.py::

'external_dependencies': {
    'python': ['genshi']
}

This will unfortunately only warn you when you try to install that module but will not help auto installers like pip. But this could be a good start...

Revision history for this message
Georges Racinet (gracinet) wrote :

Hi Florent,

well, the recipe could parse all available __openerp__.py and add those deps automatically.
Fell free to ask for this in a new issue if that's of use to you :-)

But I fear that since this declaration is currently almost useless that it's seldom correctly filled, isn't it ?

Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> Shall we fill a bug report on openerp-addons, then ?

I forwarded the issue to the person who wrote the code so that probably isn't necessary.

Revision history for this message
Florent Aide (florent-aide) wrote :

Well it has its use cases even if limited because at least it avoids a user installing a module and the server crashing because of a missing import... this is a life saver and I for one systematically take care to add my deps in this fashion to avoid issues.

But I don't see how the main server setup.py could cope with all modules' deps... So this way of doing seems like a good starting point to implement sane python deps declarations in OpenERP modules

Revision history for this message
Georges Racinet (gracinet) wrote :

Point taken Florent, it's true I don't think often in terms of the users installing modules themselves…
That is indeed motivation to fill them correctly.

Anyway, it's an interesting added value for the recipe (see #1207456)

Revision history for this message
Georges Racinet (gracinet) wrote :

The dependency on 'requests' has been lifted from OpenERP addons (http://bazaar.launchpad.net/~openerp/openobject-addons/trunk/revision/8842)

That solves the issue, with nothing more to fix in the recipe (buildbot agrees with that)

Xavier: thanks for relaying
Brad: thanks for the report

Changed in anybox.recipe.openerp:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.