h2o
h2o

Reputation: 513

Zopeskel ImportError: cannot import name BasicNamespace

I have zopeskel 2.21.2 in my virtualenv python and it works fine. Meanwhile, I also have the same version of zopeskel in my Plone buildout (located in ~/.buildout/eggs). However, it does not work. Running zopeskel --list throws the following error:

ImportError: cannot import name BasicNamespace

An advice from this link says to remove the egg. I have removed the egg as well as the cached package in ~/.buildout/cache/dist/ and ran buildout again. However, the problem persists. The funny thing is that the paster script in the same buildout is working.

My zopeskel section in buildout.cfg looks like below:

[zopeskel]
recipe = zc.recipe.egg
eggs =
    ZopeSkel
    Paste
    PasteDeploy
    PasteScript
    zopeskel.dexterity
    ${instance:eggs}

Some package versions used in my buildout:

'/home/user/.buildout/eggs/Paste-1.7.5.1-py2.6.egg',
'/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg',
'/home/user/.buildout/eggs/PasteDeploy-1.3.4-py2.6.egg',
'/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg',

Full traceback:

[user@rizal myplone.site]$ ./bin/zopeskel --list
Traceback (most recent call last):
  File "./bin/zopeskel", line 346, in <module>
    import zopeskel.zopeskel_script
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
    from zopeskel.basic_namespace import BasicNamespace
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/basic_namespace.py", line 2, in <module>
    from zopeskel.vars import var, DottedVar, StringVar, BooleanVar, TextVar
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/vars.py", line 2, in <module>
    from paste.script.templates import var as base_var
  File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/templates.py", line 6, in <module>
    import copydir
  File "/home/user/.buildout/eggs/PasteScript-1.7.4.2-py2.6.egg/paste/script/copydir.py", line 4, in <module>
    import pkg_resources
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 700, in subscribe
    callback(dist)
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2727, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 2230, in activate
    map(declare_namespace, self._get_metadata('namespace_packages.txt'))
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1827, in declare_namespace
    _handle_ns(packageName, path_item)
  File "/home/user/.buildout/eggs/distribute-0.6.24-py2.6.egg/pkg_resources.py", line 1797, in _handle_ns
    loader.load_module(packageName); module.__path__ = path
  File "/usr/lib/python2.6/pkgutil.py", line 238, in load_module
    mod = imp.load_module(fullname, self.file, self.filename, self.etc)
  File "/home/user/.buildout/eggs/ZopeSkel-2.21.2-py2.6.egg/zopeskel/__init__.py", line 2, in <module>
    from zopeskel.basic_namespace import BasicNamespace
ImportError: cannot import name BasicNamespace

What could be wrong?

Upvotes: 3

Views: 642

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83768

This usually happens you have ZopeSkel / Paster installed both locally (buildout) and in the global Python installation. Due to failures in Python process of managing site packages you end up with an incompatible combiation.

Solution:

http://docs.plone.org/manage/troubleshooting/exceptions.html#from-zopeskel-basic-namespace-import-basicnamespace

Upvotes: 5

Related Questions