7

I am trying to install the scikits.nufft package here I download the zip file, unpack and cd to the directory. It contains a setup.py file so I run

python setup.py install

but it gives me the following error related to my PYTHONPATH

sudo python setup.py install
sudo: unable to resolve host Lenovo
/usr/local/lib/python2.7/dist-packages/distribute-0.6.31-py2.7.egg/setuptools/command/install_scripts.py:3: UserWarning: Module dap was already imported from None, but /usr/lib/python2.7/dist-packages is being added to sys.path
 from pkg_resources import Distribution, PathMetadata, ensure_directory
running install
Checking .pth file support in /usr/local/lib/python2.7/site-packages/
/usr/bin/python -E -c pass
TEST FAILED: /usr/local/lib/python2.7/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH
You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
 /usr/local/lib/python2.7/site-packages/
and your PYTHONPATH environment variable currently contains:
 ''
Here are some of your options for correcting the problem:
* You can choose a different installation directory, i.e., one that is
 on PYTHONPATH or supports .pth files
* You can add the installation directory to the PYTHONPATH environment
 variable. (It must then also be on PYTHONPATH whenever you run
 Python and want to use the package(s) you are installing.)
* You can set up the installation directory to support ".pth" files by
 using one of the approaches described here:
 http://packages.python.org/distribute/easy_install.html#custom-installation-locations
Please make the appropriate changes for your system and try again.

It seems to think the path is empty but when I check my path I get,

echo $PYTHONPATH
/usr/local/lib/python2.7/site-packages:/home/david/PYTHON

Does anyone know why it might think the path is empty?? or have any other ideas as to what may be wrong here. Thanks, Dave

asked May 23, 2013 at 11:14
1
  • 5
    Well, even if your PYTHONPATH looks correct, it may not necessarily be correct after the sudo. Try bringing up a root shell first with sudo su -, then check PYTHONPATH looks right before running the script from the same shell. Commented May 23, 2013 at 12:54

2 Answers 2

7

After Aya's comment above I found similar resolved problem here and got it to run by adding

Defaults env_keep += "PYTHONPATH"

to the sudoers file. Ta, Dave

answered May 23, 2013 at 18:51
Sign up to request clarification or add additional context in comments.

Comments

3

For the people that want to avoid sudo and install under local user:

PYTHONPATH=~/local/lib/python2.7/site-packages/ python ./distribute_setup.py
answered Jul 30, 2014 at 9:41

1 Comment

Thanks, this was really useful, but only worked when I used bash. Perhaps you should improve your answer a bit.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.