[Numpy-discussion] Problems installing not as root

Fernando Perez Fernando.Perez at colorado.edu
Mon Jun 7 16:41:03 EDT 2004


Ryan Gutenkunst wrote:
> Hi all,
> 
> I'm trying to install Numerical Python without root access, and I'm 
> having great difficulty.
> 
> I'm running Python 2.2.2 (which was installed systemwide by root). I 
> used 'python setup.py install --prefix ~/installed' to install numpy and 
> I have ~/installed/lib/python2.2/site-packages in my PYTHONPATH.
> 
> Initially 'import' was failing, but  creating an empty __init.py__ in 
> site-packages/Numeric seems to have fixed that. I still can't seem to 
> use any of the functions, though. I get errors like:

Don't do this, it's a bit tricky to get it right.  You're stuck in .pth hell, 
because Numeric is not a true python package, and python only picks up .pth 
files in a few locations in the filesystem (NOT in all of your pythonpath). 
Since those locations are all root-only, you'll need to add explicitly

~/installed/lib/python2.2/site-packages/Numeric

to your PYTHONPATH for things to work smoothly.

If you insist, here's a hacked __init__.py to fake what you are looking for:

littlewood[Numeric]> cat __init__.py
# fperez.  Hack to make Numeric behave like a real package, regardless of 
where it's
# installed.  This is needed because Numeric relies on a .pth file for path
# manipulations, but those are ONLY scanned in sys.prefix, not for all paths in
# PYTHONPATH.

import sys
sys.path.append('/usr/local/lib/python/Numeric')  #put what you need here
from Numeric import *

#--------------- fix the linebreaks above before using

Unfortunately it doesn't look like Numeric will become a true python package, 
so we're stuck with these hacks.  Welcome to the club of .pth haters :)

Cheers,

f




More information about the NumPy-Discussion mailing list