amb1s1 amb1s1 - 2 months ago 12x
Python Question

Error when installing python settuptools - No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8811.pth'

I'm trying to install settuptools on a linux machine that I don't have root access. I already create the virtual python.

dgomez:~/download> which python

when I do the following, I get an error:


error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/test-easy-install-8816.pth'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:


This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir


I would like to know how to fix this. I see in other forum where the user fixed it by creating the directory, but in my case I don't have root access for I can't create a directory. Thanks


I ran the python --install-dir=/home/dgomez/lib/python2.7/site-packages/

Bu still getting an error:

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:


and your PYTHONPATH environment variable currently contains:



The error message tells you exactly what to do, use the --install-dir or --prefix option so the package installs to your virtual Python installation instead of the default location.

This might look something like this:

/home/dgomez/bin/python --prefix=/home/dgomez

Or with --install-dir:

/home/dgomez/bin/python --install-dir=/home/dgomez/lib/python2.7/site-packages

Note that you may need to modify the directories used in the options above depending on the actual location of the site-packages directory of your Python installation.

edit: To fix the new error you are seeing, you need to add that directory to the PYTHONPATH environment variable, you can do that with the following command:

export PYTHONPATH=$PYTHONPATH:/home/dgomez/lib/python2.7/site-packages/

If you are using bash on a Mac or GNU/Linux distro, you can add that line to your ~/.bashrc file so that you won't need to run it manually.