I'm finding that my pythonpath environment variable is ignored. I'm using python 2.6 on ubuntu. I have in my .bashrc
the following:
export PTYHONPATH=/my/home/mylibs/lib/python2.6/site-packages/:$PYTHONPATH
Then I install a new version of numpy
using:
python setup.py install --prefix=/my/home/mylibs/
and it gets correctly installed locally. However, when I try to install other packages (also using setup.py
) that depend on the new version of numpy, they cannot find it, because by default the loaded numpy is the one in /usr/llib
, and not the one specified in my PYTHONPATH
. My PYTHONPATH
gets correctly set but the system-wide directory is still overruling it.
How can this be fixed? I just want my local version of numpy
to be accessed when I do import numpy
. I saw other posts related to this with python 2.4 but as far as I can tell it never got resolved. Also, i'd like to do this without installing pip or virtualenv for now. It seems like it should be possible using --prefix
or --home
options passed to setup.py
and then alteration of PYTHONPATH
but this does not work for me... the system wide lib
dirs are read first.
edit: I try to follow the suggestions and use pip
. I have a system wide install of an old pip
that does not recognize --user
(ver 0.3). I tried to upgrade pip
with pip
itself but of course that failed because I cannot install it locally, so pip install pip --upgrade --user
is not an option. I downloaded a new version of pip
and installed locally in my home directory but the system wide old one is still used when I type pip
at the prompt. I looked into the pip
package and found runner.py
so I tried to use it to install packages using:
runner.py install --user numpy --upgrade
That still fails with permission denied:
OSError: [Errno 13] Permission denied: '/usr/bin/f2py2.6'
It looks like --user
is broken. I also am not sure how this would solve the fact that the system wide python uses the system wide packages in /usr/lib
... is there a solution to this? It seems like it's virtually impossible to install local packages in python nowadays.