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
/home/dgomez/bin/python
when I do the following, I get an error:
/home/dgomez/bin/python ez_setup.py
Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
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:
/usr/local/lib/python2.7/site-packages/
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
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
ez_setup.py --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:
/home/dgomez/lib/python2.7/site-packages/
and your PYTHONPATH environment variable currently contains:
''
Follow the below steps to install the Setuptools package on Linux using the setup.py file: Step 1: Download the latest source package of Setuptools for Python3 from the website. Step 3: Go to the setuptools-60.5. 0 folder and enter the following command to install the package.
To solve the "Error: legacy-install-failure":Upgrade your versions of pip , setuptools and wheel before running pip install . Check if your Python version is supported by the package. On Windows, download and install the package from unofficial binaries. Try to install the package with the --pre option.
Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process. Voila!
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 ez_setup.py --prefix=/home/dgomez
Or with --install-dir
:
/home/dgomez/bin/python ez_setup.py --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.
I met the same issue. Somehow this directory had been deleted, so I did not have pip and setuptools. The way I solved is to download pip directly from pip website. I solved it by downloading the pip file from get-pip.py. After downloading, just run this file in your python direction, you can use this setuptools again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With