Search code examples
pythoneclipsepydevpyramid

zope.deprectation: solve import issues with pydev, .pth files and site-packages


I'm using python 3.4.2 in a virtual environment. I've setup pydev to use my virtual environment interpreter with the virtual environment's site-packages directory.

Everything is fine from the command line when I run the virtual environment's version of python. I can import everything correctly.

However, sometimes I have issues inside PyDev even though it's configured for the virtual environment.

One big issue I am having is PyDev is not seeing zope.deprecation. This is likely due to the fact that in site-packages, the zope directory does not have a init.py file. In fact creating this file makes PyDev see zope.deprecation.

In the site-packages directory the zope.deprecation package does come with zope.deprecation-4.1.1-py3.4-nspkg.pth and zope.deprecation-4.1.1-py3.4.egg-info which I assume are supposed to aid in setting up things correctly.

But PyDev doesn't seem to understand.

(I have a similar problem with the newrelic...it's directory structure under site-packages is not 'canoncial' but it also comes with a .pth file to help the interpreter understand where to find things).

My question is how do I get PyDev to understand the site-packages environment correctly?

Manually touching a init.py is completely hacky...

Thanks!


Solution

  • PyDev does not support namespace packages. Here is bug report https://sw-brainwy.rhcloud.com/tracker/PyDev/151

    By the way, PyCharm (great Python IDE) does support namespace packages since 2012 –

    PyCharm has been updated to support the new language features of Python 3.3, including the new namespace packages.