pythonvirtualenvnamespace-package

Namespace package conflict


I have a package that I'm working on (LDB_Algebra). It has an extra that depends on another package that I created (LDB_LAPACK). I have created a virtualenv and installed each of these packages as shown:

$ virtualenv -p pypy ve_pypy
$ . ve_pypy/bin/activate
(ve_pypy) $ pip install LDB_LAPACK
...
(ve_pypy) $ python setup.py install
... (Installs LDB_Algebra)

Each has the following for its __init__.py file under the ldb package:

__import__('pkg_resources').declare_namespace(__name__)

Problem:

The trouble is that when I try to use ldb.algebra it reports that it can't find the package. Just to make sure it hasn't completely lost everything I attempt to import ldb.lapack and that works fine. This suggests to me that I'm having a namespace package problem. It seems a similar question has been asked here (with no answer sadly). Upon investigating the directory structure of my virtualenv I find that under ve_pypy/site-packages/ there is a folder for the ldb namespace package which includes the lapack package but not the algebra package. I also see an egg file, LDB_Algebra-0.3.2-py2.7.egg. Inside this egg file in the ldb directory is an __init__.py file with the appropriate namespace declaration (as above). Presumably this is supposed to be where it gets the ldb.algebra package from but it's not looking there.

Questions:

  1. Can anyone confirm with a reference that what I'm seeing is a known issue (i.e. that I'm not just doing some slightly wrong that's causing all these troubles)? Are eggs and w/e the pip install method created (the ldb package directory under site-packages) fundamentally incompatible?

  2. Assuming that the answer to the first question is that my method of package installing is fundamentally flawed, is there an easier way of installing the LDB_LAPACK package from pypi and the LDB_Algebra package from my local directory? I'm not a setuptools wiz or anything so the answer may be very straightforward (don't overlook the obvious).


Solution

  • Apparently this is a well known problem. The solution that was suggested to me and seems to work fine is to use pip install . instead of python setup.py install.