Ticket #2831 (closed enhancement: duplicate)

Opened 2 years ago

Last modified 1 year ago

Nevow doesn't work with buildout, due to the fact that it imports itself in setup.py

Reported by: benliles Assigned to: zooko
Priority: normal Milestone:
Component: Nevow Severity: normal
Keywords: Cc: glyph
Estimated Completion (YYYY/MM/DD): Branch:
Author:

Description (Last modified by glyph)

Because the _version.py imports from twisted, twisted must be on the system path which makes Nevow incompatible with buildout. It would be nice if there was a test around it so that if twisted isn't in the system path and cannot be imported, then reply with a hardcoded version. This way it can still be used with buildout.

Nevow-0.9.32/setupcommon.py", line 2
Nevow-0.9.32/nevow/__init__.py", line 5
Nevow-0.9.32/nevow/_version.py", line 2
ImportError: No module named twisted.python

Change History

01/27/09 15:15:50 changed by exarkun

  • status changed from new to closed.
  • resolution set to duplicate.

This should be fixed in the next release. See #2527.

04/27/09 14:55:08 changed by benliles

  • status changed from closed to reopened.
  • resolution deleted.

Using setuptools does not fix the fact that there is still an import from a file that assumes that Twisted is already in the system path, which is not necessarily true at install time.

04/27/09 14:57:48 changed by benliles

This may be fixed by adding an 'install_requires' in the setup dictionary when using setuptools.

04/27/09 15:00:02 changed by exarkun

Can you describe the user-facing misbehavior which is still present? It sounds like it has something to do with installing Nevow when Twisted is not installed, but it'd be great if you could go into some detail.

04/27/09 15:41:48 changed by benliles

When using easy_install or buildout, they automatically grab dependencies listed in the setup dictionary from the PyPi?. They don't necessarily have the same system path as your python executable, especially with buildout (virtual environment like installation system).

Nevow isn't installable with either of these because setup.py imports from nevow which in turn imports from Twisted in order to generate the version string.

I checked out the subversion trunk and modified the setup.py to add the 'install_requires=Twisted?', but that does not add Twisted to the path at setup time. There is a separate 'setup_requires' parameter that I think, but that places eggs in odd places.

There are a few ways to take care of the problem, one would be adding a try/except block around the version import with a fallback to a hardcoded version of some kind. This is the route that others seem to be taking because it simplifies things quite a bit.

04/27/09 15:59:58 changed by glyph

  • description changed.

Fixing the half-traceback reported in the description.

04/27/09 16:11:12 changed by glyph

  • owner changed from exarkun to zooko.
  • status changed from reopened to new.
  • description changed.
  • summary changed from Nevow not working with buildout/easy_install to Nevow doesn't work with buildout, due to the fact that it imports itself in setup.py.

I've tried to update the summary to reflect a bit more clearly what is going on here. I've removed easy_install from the summary, since easy_install nevow works for me in the various configurations in which I've tried it. (Granted, I haven't been exhaustive, but it's very hard to be exhaustive with any configuration related to distutils.)

I assume that buildout invokes easy_install in some configuration where the system path is different from the install-target path. By the way, since setuptools aggressively tries to make sure that you absolutely will be able to import everything no matter what, I'm curious as to how one convinces easy_install to work at all in such a configuration.

It would be helpful if you could provide reproduction instructions; assume we don't know anything at all about buildout, because we don't.

I've also reassigned this to zooko since he seems more interested in setuptools than anyone else. I hope his interest endures :).

(Also: I added a link to the "buildout" site in the description.)

04/27/09 16:12:32 changed by glyph

  • type changed from defect to enhancement.

I'm also going to say this is a feature request, rather than a bug, because "works with buildout!" isn't advertised anywhere in Nevow. Arguably the fact that it doesn't work out of the box is a bug in buildout, not Nevow.

04/27/09 16:21:53 changed by benliles

By the way, easy_install doesn't work if you don't already have Twisted installed.

04/27/09 16:52:48 changed by glyph

  • cc set to glyph.

05/19/09 15:11:25 changed by zooko

  • status changed from new to closed.
  • resolution set to duplicate.

This is a duplicate of #2699.

jethro@divmod.org