[Distutils] Buildout 2 and system packages
Lele Gaifax
lele at metapensiero.it
Mon Feb 11 19:01:42 CET 2013
Jim Fulton <jim at zope.com> writes:
> I'm very happy, finally, to have released buildout 2.0.0.
I'm happy too, congrats to everybody contributed!
> Much has changed from buildout 1:
>
> http://pypi.python.org/pypi/zc.buildout/2.0.0#id3
* Buildout no-longer tries to provide full or partial isolation from
system Python installations. If you want isolation, use buildout with
virtualenv, or use a clean build of Python to begin with.
Ok, I think I'm hitting this, trying to update one project: one of its
scripts fails with the following traceback::
$ .../bin/initialize_cpi_db --development src/cpi/development.ini
Traceback (most recent call last):
File ".../bin/initialize_cpi_db", line 51, in <module>
import cpi.scripts.initializedb
File ".../src/cpi/cpi/__init__.py", line 10, in <module>
from pyramid.config import Configurator
File ".../eggs/pyramid-1.4-py2.7.egg/pyramid/config/__init__.py", line 21, in <module>
from pyramid.authorization import ACLAuthorizationPolicy
File ".../eggs/pyramid-1.4-py2.7.egg/pyramid/authorization.py", line 9, in <module>
from pyramid.security import (
File ".../eggs/pyramid-1.4-py2.7.egg/pyramid/security.py", line 12, in <module>
from pyramid.threadlocal import get_current_registry
File ".../eggs/pyramid-1.4-py2.7.egg/pyramid/threadlocal.py", line 3, in <module>
from pyramid.registry import global_registry
File ".../eggs/pyramid-1.4-py2.7.egg/pyramid/registry.py", line 5, in <module>
from zope.interface.registry import Components
ImportError: No module named registry
And the problem is that, even if I explicitly said it needs the
zope.interface egg, and pinned it to version 4.0.3, the script sees the
system wide zope.interface installed by the underlying Ubuntu host::
$ cat .../bin/initialize_cpi_db
#!/usr/bin/python
import sys
sys.path[0:0] = [
'.../eggs/SQLAlchemy-0.8.0b2-py2.7-linux-i686.egg',
'.../src/cpi',
'.../eggs/docutils-0.10-py2.7.egg',
'.../eggs/logutils-0.3.3-py2.7.egg',
'.../src/metapensiero.extjs.desktop/src',
'.../src/metapensiero.sphinx.patchdb/src',
'.../src/metapensiero.sqlalchemy.proxy/src',
'.../eggs/psycopg2-2.4.6-py2.7-linux-i686.egg',
'.../eggs/pyramid-1.4-py2.7.egg',
'.../eggs/pyramid_beaker-0.7-py2.7.egg',
'.../eggs/pyramid_mailer-0.10-py2.7.egg',
'.../eggs/rst2pdf-0.93.dev-py2.7.egg',
'.../eggs/simplejson-3.0.7-py2.7-linux-i686.egg',
'.../eggs/Babel-1.0dev_r661-py2.7.egg',
'.../eggs/Sphinx-1.1.3-py2.7.egg',
'.../eggs/coverage-3.5.1-py2.7-linux-i686.egg',
'.../eggs/lingua-1.4-py2.7.egg',
'.../eggs/nose-1.2.1-py2.7.egg',
'.../eggs/nose_progressive-1.4-py2.7.egg',
'.../eggs/yuicompressor-2.4.7-py2.7.egg',
'.../eggs/blessings-1.3-py2.7.egg',
'.../eggs/xlwt-0.7.4-py2.7.egg',
'.../eggs/xlrd-0.8.0-py2.7.egg',
'.../eggs/polib-1.0.2-py2.7.egg',
'.../eggs/Jinja2-2.6-py2.7.egg',
'.../eggs/Pygments-1.5-py2.7.egg',
'.../eggs/pdfrw-0.1-py2.7.egg',
'/usr/lib/python2.7/dist-packages',
'.../eggs/repoze.sendmail-3.2-py2.7.egg',
'.../eggs/Beaker-1.6.4-py2.7.egg',
'.../eggs/PasteDeploy-1.5.0-py2.7.egg',
'.../eggs/translationstring-1.1-py2.7.egg',
'.../eggs/venusian-1.0a6-py2.7.egg',
'.../eggs/zope.deprecation-4.0.0-py2.7.egg',
'.../eggs/zope.interface-4.0.3-py2.7-linux-i686.egg',
'.../eggs/repoze.lru-0.6-py2.7.egg',
'.../eggs/WebOb-1.2.3-py2.7.egg',
'.../eggs/Mako-0.7.2-py2.7.egg',
'.../eggs/Chameleon-2.11-py2.7.egg',
'.../eggs/zope.sqlalchemy-0.7.1-py2.7.egg',
'.../eggs/waitress-0.8.1-py2.7.egg',
'.../eggs/transaction-1.3.0-py2.7.egg',
'.../eggs/pyramid_tm-0.5-py2.7.egg',
'.../eggs/MarkupSafe-0.15-py2.7-linux-i686.egg',
]
import cpi.scripts.initializedb
if __name__ == '__main__':
sys.exit(cpi.scripts.initializedb.main())
You may notice the “/usr/lib/python2.7/dist-packages” right in the
middle of the generated load path::
$ bin/python
>>> import zope.interface
>>> print(zope.interface)
<module 'zope.interface' from '/usr/lib/python2.7/dist-packages/zope/interface/__init__.pyc'>
I do understand that the documentation says “use virtualenv” to fix the
issue, but I'm curious about the position of the “dist-packages” in the
list:
1) why does it ends in the middle?
2) is (the position) controllable/explicitly determinable in some way?
Thanks a lot,
bye, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it | -- Fortunato Depero, 1929.
More information about the Distutils-SIG
mailing list