[BioPython] Re: biopython install problems

Brad Chapman chapmanb at uga.edu
Thu Mar 4 12:35:25 EST 2004


Hi Jacob;
[Copying to the Biopython list]

> I'm following the instructions at
> 
> http://www.biopython.org/docs/install/Installation.html
> 
> python setup.py install --home=~/usr
> 
> to install the package under my ~/usr directory, and it works fine (the 
> package is installed in ~/usr/lib/python).
> 
> I do the exact same thing with the Numeric package and it does put a 
> directory called Numeric (along with a Numeric.pth file) where I 
> expected, but it also puts some other files in ~/usr/include/python.
> 
> And when I try to import this package, I get
> 
> Python 2.3.2 (#1, Nov 13 2003, 20:02:35)
> [GCC 3.3.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import mx
> >>> from Numeric import *
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named Numeric
> >>>
> 
> When I look in the ~/usr/lib/python/Numeric directory, I find no 
> __init__.py file as under ~/usr/lib/python/mx. Does that have anything 
> to do with the problem, and do you have other suggestions?

Yes, the problem is that Numeric uses that Numeric.pth file to
basically change the sys.path to include it's directory for
importing. The problem is, that *.pth files only work in the
"official" site-packages directory (/usr/local/lib/python2.3/site-packages 
type places).

The fix, as you mention, is just to add an __init__.py to the
Numeric directory to make it executable ('touch __init__.py' in that
directory works file). Then if ~/usr/lib/Numeric is in your
PYTHONPATH, everything should work smoothly:

>>> import Numeric
>>> Numeric.__file__
'/usr/home/chapmanb/usr/lib/python/Numeric/__init__.py'
>>> 

Hope this makes sense and sorry about the confusion.
Brad


More information about the BioPython mailing list