Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import Error in zope.interface.registry in python

I am installing a project in virtual environment. I am getting error

from zope.interface.registry import Components
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named registry

Version of this module as 4.0.5

>>> import pkg_resources
>>> pkg_resources.get_distribution("zope.interface").version
'4.0.5'

I tried the same on my machine (not virtual env),

>>> import pkg_resources
>>> pkg_resources.get_distribution("zope.interface").version
'4.0.1'
>>> from zope.interface.registry import Components

Here from zope.interface.registry import Components didn't give any error. According to this

QUOTE: 3.8.0 (2011-09-22) 
New module zope.interface.registry. This is code moved from 
zope.component.registry which implements a basic nonperistent component registry 
as zope.interface.registry.Components.

, it should not give any error. Any suggestion what I'm missing here or how to solve this error ?

like image 583
Netro Avatar asked Oct 05 '22 15:10

Netro


1 Answers

I had similar error - I tryed to create new virtual env without site-packages. It creates all fine. But my ubuntu has already installed zope.interface for own use, so it did not want to install it additional to my venv.

This collision cause my venv to throw error in simple test app under mod_wsgi:

     from zope.interface.registry import Components
ImportError: No module named registry

So I trying to remove zope.interface from base python. But unistall command not removed it(i found in google, that it is known problem).

Than i found solution: I just switched to my venv and give command for "upgrading" zope.interface from there:

(env)user@ubuntu:~/env$ sudo pip install --upgrade zope.interface

After this my problem with zope.interface dissmiss.

Your problem is similar, so my solution could help. Anyway this answer is very useful for ubuntu desktop users.

like image 119
msangel Avatar answered Oct 10 '22 03:10

msangel