[Distutils] [issue20] package required at build time seems to be not fully present at install time?

Zooko O'Whielacronx setuptools at bugs.python.org
Tue Jun 3 03:42:38 CEST 2008


New submission from Zooko O'Whielacronx <zooko at zooko.com>:

If you try to install this minimal project:

"""
import setuptools
setuptools.setup(name="minproj_that_needs_nevow", install_requires=["Nevow"]
"""

You'll get a reasonable-looking traceback that ends with an ImportError in which
Nevow tried to import Twisted at install time.  (Note that Nevow does not
declare its install-time dependency on Twisted -- see
http://divmod.org/trac/ticket/2629 .)

"""
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 427, in easy_install
    return self.install_item(None, spec, tmpdir, deps, True)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 478, in install_item
    self.process_distribution(spec, dist, deps)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 519, in process_distribution
    [requirement], self.local_index, self.easy_install
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py",
line 522, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py",
line 758, in best_match
    return self.obtain(req, installer) # try and download/install
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py",
line 770, in obtain
    return installer(requirement)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 446, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 476, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 655, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 930, in build_and_install 
    self.run_setup(setup_script, setup_base, args)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 919, in run_setup
    run_setup(setup_script, args)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/sandbox.py",
line 27, in run_setup
    lambda: execfile(
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/sandbox.py",
line 63, in run
    return func()
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/sandbox.py",
line 29, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 8, in <module>

  File "/tmp/easy_install-1aI_wu/Nevow-0.9.31/setupcommon.py", line 2, in <module>
  File "/tmp/easy_install-1aI_wu/Nevow-0.9.31/nevow/__init__.py", line 5, in
<module>
  File "/tmp/easy_install-1aI_wu/Nevow-0.9.31/nevow/_version.py", line 2, in
<module>
ImportError: No module named twisted.python
"""

This is the same behavior as if you had simply executed "easy_install Nevow".

The _version.py file in question is visible here:

http://divmod.org/trac/browser/trunk/Nevow/nevow/_version.py?rev=14968

However, if you try to install this minimal project:

"""
import setuptools
setuptools.setup(name="minproj_that_needs_nevow", setup_requires=["Twisted"],
install_requires=["Nevow"]
"""

You'll get a slightly strange error message which suggests that Nevow got
further in its attempt to use Twisted, but not far enough:

"""
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 478, in install_item
    self.process_distribution(spec, dist, deps)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 519, in process_distribution
    [requirement], self.local_index, self.easy_install
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py",
line 522, in resolve
    dist = best[req.key] = env.best_match(req, self, installer)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py",
line 758, in best_match
    return self.obtain(req, installer) # try and download/install
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/pkg_resources.py",
line 770, in obtain
    return installer(requirement)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 446, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 476, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 655, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 930, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/command/easy_install.py",
line 919, in run_setup
    run_setup(setup_script, args)
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/sandbox.py",
line 27, in run_setup   
    lambda: execfile(
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/sandbox.py",
line 63, in run
    return func()
  File
"/usr/local/stow/python-release25-maint-2008-05-30/lib/python2.5/site-packages/setuptools-0.6c8-py2.5.egg/setuptools/sandbox.py",
line 29, in <lambda>
    {'__file__':setup_script, '__name__':'__main__'}
  File "setup.py", line 8, in <module>

  File "/tmp/easy_install-Nib-SJ/Nevow-0.9.31/setupcommon.py", line 2, in <module>
  File "/tmp/easy_install-Nib-SJ/Nevow-0.9.31/nevow/__init__.py", line 10, in
<module>
ImportError: No module named components
"""

The __init__.py file in question is here:

http://divmod.org/trac/browser/trunk/Nevow/nevow/__init__.py?rev=14968

Now if you try to install the actual project -- allmydata.org Tahoe -- from
which this minimal project was extracted:

http://allmydata.org/trac/tahoe/browser/setup.py

You'll get a bizarre error message that takes the name of PIL in vain:

"""
 File
"/home/agl/src/allmydata-tahoe-1.0.0-r2613/setuptools-0.6c8.egg/setuptools/sandbox.py",
line 27, in run_setup
 File
"/home/agl/src/allmydata-tahoe-1.0.0-r2613/setuptools-0.6c8.egg/setuptools/sandbox.py",
line 63, in run
 File
"/home/agl/src/allmydata-tahoe-1.0.0-r2613/setuptools-0.6c8.egg/setuptools/sandbox.py",
line 29, in <lambda>
 File "setup.py", line 8, in <module>
   #
 File "/tmp/easy_install-fqJkNC/Nevow-0.9.18/setupcommon.py", line 2,
in <module>
 File "/usr/lib/python2.5/site-packages/PIL/__init__.py", line 10, in <module>
   #
ImportError: No module named components
"""

Note that allmydata.org Tahoe does not use PIL in any way.  There are no hits
for "grep -r PIL ." in the Tahoe source tree.

Going back to the minimal projects, we can tell that this effect has something
to do with the presence or absence of a Twisted*.egg in the current working
directory when "./setup.py install" is invoked.  That is:

If this minimal project is invoked in an empty directory (and also when no
Twisted, Nevow, or zope.interface installed in the system), then we get the
weird error about failure to import components even though the earlier "from
twisted.python import versions" succeeded.  This will leave a Twisted .egg in
the CWD.

If it is invoked in an otherwise empty directory that has a Twisted egg, then it
will succeed (and leave a Twisted .egg in the CWD).  (Hm.  Actually now that I
look in the target install directory, I see that it installed Nevow into there
but not Twisted or zope.interface (which Twisted requires).  It seems like that
is a problem, but it is probably a separate problem from this ticket.)

----------
messages: 35
nosy: zooko
priority: bug
status: unread
title: package required at build time seems to be not fully present at install time?

_______________________________________________
Setuptools tracker <setuptools at bugs.python.org>
<http://bugs.python.org/setuptools/issue20>
_______________________________________________


More information about the Distutils-SIG mailing list