I am trying to use easy_install to install a module called requests by doing
easy_install requests
This worked fine a week ago when I was using Python 2.6.5 but today I installed Python 2.7.2 and then tried to import requests in one of my scripts but it failed. I then tried reinstalling requests with easy_install requests but got this error
install_dir /usr/local/lib/python2.6/dist-packages/
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 13] Permission denied: '/usr/local/lib/python2.6/dist-packages/test-easy-install-15207.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.6/dist-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://packages.python.org/distribute/easy_install.html
Please make the appropriate changes for your system and try again.
So I was told to go reinstall easy_install and I went to http://pypi.python.org/pypi/setuptools and learned I had to
delete all setuptools*.egg and setuptools.pth files from your
system's site-packages directory (and any other sys.path directories)
FIRST.
So I did this. I then reinstalled setuptools from the setuptools-0.6c11-py2.7.egg. It seemed successful but when I ran easy_install requests I got basically the same error except the directory python2.6/dist-packages is now python2.7/site-packages
siddhion#siddhion-laptop:~$ easy_install requests
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 13] Permission denied: '/usr/local/lib/python2.7/site-packages/test-easy-install-16253.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://peak.telecommunity.com/EasyInstall.html
Please make the appropriate changes for your system and try again.
Also, when I do easy_install and press tab I get these options
easy_install easy_install-2.6 easy_install-2.7
How come easy_install-2.6 is there?
and
How do I get easy-install working again?
Did you try using sudo like this?
sudo easy_install requests
Or specify the install directory to a directory that you have write privileges.
easy_install --install-dir=/home/foo/bar
But you should really use PIP instead of easy_install. It is much better and has a lot more features.
You should use virtualenv on package-based Linux distributions so Python scripts don't interfere with other packages or conflict with the OS's package-manager.
http://workaround.org/easy-install-debian
The following worked for me with Ubuntu 12.10 installing easy_install then pip:
sudo apt-get install python-virtualenv
curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
sudo python get-pip.py
Have you tried adding your new python.framework to path?
On mountain lion I added
/Library/Frameworks/Python.framework/Versions/3.3/bin/
to
/etc/paths
and then I was able to use easy_install-3.3 and pip-3.3
Using Sudo before easy_install may solve your problem
Sudo easy_install requests
thanks
It might be a simple case of you missing "sudo" in the front. Can you try it with sudo easy-install requests
putting the "sudo" will add the required permissions.
Related
I need to install https://pypi.python.org/pypi/PasteScript on a VM without sudo access (this one, if relevant). I've downloaded it but when I run python setup.py install I get:
running install Checking .pth file support in
/usr/local/lib/python2.7/dist-packages/ 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 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-1621.pth'
The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:
/usr/local/lib/python2.7/dist-packages/
Perhaps your account does not have write access to this directory? If
the installation directory is a system-owned directory, you may need
to sign in as the administrator or "root" account.
One alternative suggestion I found was to use pip, but I can't install pip without sudo.
PS: There are many similar questions, but none (that I can find!
What about:
python setup.py install --user
As stated in the doc, it should work as you expect: https://docs.python.org/2/install/#alternate-installation-the-user-scheme
I am using a Mac and I get an error message on my terminal when I try to install Beautiful Soup. I have Python 3 installed already.
This is what I did after unpacking the Beautiful Soup zip file
$ cd Users/thepredestrian/Desktop/beautifulsoup4-4.4.1
$ python setup.py install
This is the error message that appears:
Checking .pth file support in /Library/Python/2.7/site-packages/
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 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-966.pth'
The installation directory you specified (via --install-dir, --prefix,
or the distutils default setting) was:
/Library/Python/2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again
Any advice appreciated!
Try installing with sudo.
sudo python setup.py install
An alternate way is to use virtual environment. Inside a virtual environment, you can install dependencies locally rather than system wide, so you won't need access to a root account.
pip install virtualenv
virtualenv test
cd test
source bin/activate
The first line installs virtualenv. The second line creates a virtual environment. The third and fourth line activates (starts) the virtualenv. You will notice the change in prompt. Inside virtualenv, you can install dependencies (e.g BeautifulSoup), run python scripts and so on. Once you're done, you can deactivate the environment by simply typing deactivate in the shell.
I am trying to install BeautifulSoup on my macOS. While installing i m getting below.
And also I tried with python setup.py install, but getting same error
Please help me to resolve this
bash-3.2$ easy_install /Users/SJV/Downloads/beautifulsoup4-4.4.1/beautifulsoup4.egg-info
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 13] Permission denied: '/Library/Python/2.7/site-packages/test-easy-install-620.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/Library/Python/2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again.
Are you using root? Try:
sudo pip install beautifulsoup4 # will ask your sudo password
Or login as root before run pip install beautifulsoup4.
Also, install it in virtualenv or this way can without root permission(if you don't have root permission).
I want to install Sphinx 1.1.3 for python 2.6. However, I don't have sudo rights. So instead of installing it in the default place, I want to set a different location, using --prefix. Doing the following:
-bash-3.2$ easy_install Sphinx-1.1.3-py2.6.egg --prefix=/homes/ndeklein/python2.6/site-packages/
gives me:
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 13] Permission denied: '/usr/lib/python2.4/site-packages/test-easy-install-18534.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/lib/python2.4/site-packages/
Am I typing something wrong with the prefix? Also, what I could use instead (which I've used with other packages):
python setup.py install --home=/homes/ndeklein/python2.6/site-packages/
but I can't find the setup.py script. I'm guessing that EGGs don't have a setup.py script, is that true?
You need to specify options before the package, so the command should be:
easy_install --prefix=/homes/ndeklein/python2.6/site-packages/ Sphinx-1.1.3-py2.6.egg
This website discusses non-root python installs. It might be useful to you...
http://www.astropython.org/tutorials/user-rootsudo-free-installation-of-python-modules7/
To quote a little bit of it:
A user configuration file, ~/.pydistutils.cfg, will override the internal system path for python package installations, redirecting the built libraries (lib), scripts (bin) and data (share) into user owned and specified directories. You must simply tell the python installer where theses directories are located.
The user file, ~/.pydistutils.cfg, has the following lines, using a pretty obvious syntax:
[install]
install_scripts = ~/usr/bin
install_data = ~/usr/share
install_lib = ~/usr/lib/python2.4/site-packages
Of course, whatever directories you specify there should probably exist and you should put them at the front of your PYTHONPATH:
export PYTHONPATH=~/usr/lib/python2.4/site-packages:${PYTHONPATH}
It also looks like more modern python installations (compared to the things in the link) should be able to use the ~/.local directory:
easy_install --prefix=~/.local ...
There is also:
easy_install --user ...
which will install to a user-specific site directory.
You could try using pip install of easy_install(pip is recommended over easy_install these days)
Then you can just use
pip install --user Sphinx
see http://www.pip-installer.org/en/latest/installing.html on how to install pip if needed
You may also want to pip install virtualenv and work inside virtualenv(where pip will install all packages in a local site packages folder). see http://pypi.python.org/pypi/virtualenv for more info.
I am having real trouble installing SUDS in python 2.6.4. I have tried to install the setup file but it says the location of python cannot be found. This is because I have changed the location of python. I have tried to use easy_install but am having no luck. Does anyone know a simple way to do this or have a link to clear installation instructions.
Command that I entered was:
python setup.py install
The result I recieved was:
running install
error: cannot create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/usr/local/lib/python2.6/site-packages/test-easy-install-9203.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/usr/local/lib/python2.6/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
http://peak.telecommunity.com/EasyInstall.html
And if I have to change the python path how exactly do you do this.
I have tried what one site said to do and it was to first, create an altinstall.pth file in Python's site-packages directory, containing the following line:
import os, site; site.addsitedir(os.path.expanduser('~/lib/python2.3'))
Then it says modify distutils.cfg in the distutils directory with:
[install]
install_lib = ~/lib/python2.3
# This next line is optional but often quite useful; it directs EasyInstall
# and the distutils to install scripts in the user's "bin" directory. For
# Mac OS X framework Python builds, you should use /usr/local/bin instead,
# because neither ~/bin nor the default script installation location are on
# the system PATH.
#
install_scripts = ~/bin
Have you tried setting PYTHONPATH to the location of python? Maybe this way it will know, where to install it.
You are calling it with python setup.py install. Try sudo python setup.py install, if you are using some linux and you are sudoer.
I got messages like this too when I installed suds and python-ntlm. Our site has a separate areafor installations so that we can maintain multiple versions, so my first installation step was
python setup.py install --prefix=/install/suds/suds-0.4
and I got the same messages about installplace. To fix:
Make sure the directories are there with
mkdir -p /install/suds/suds-0.4/lib/python2.6/site-packages/
(This surprised me a little, I thought setup would build the directories.)
Make sure you have write permission down the tree with
chmod -R 775 /install/suds/suds-0.4/lib/python2.6/site-packages/
Neither of which got rid of the message!
The last step was to put the install area into PYTHONPATH, and then do the setup.py
export PYTHONPATH=/install/suds/suds-0.4/lib/python2.6/site-packages:$PYTHONPATH
python setup.py install --prefix=/opt/sw/fw/qce/suds/suds-0.4
with a final chmod to make the newly installed files readable in case umask is set to something restrictive:
chmod 755 /install/suds/suds-0.4/lib/python2.6/site-packages/*
After this I could start python and import suds. The key step was the putting the suds site-packages directory into PYTHONPATH.
I expect this help comes too late to help the original poster, but I hope it helps someone else who come to SO with this question. As I did.
I would need more details of your OS to give a fully accurate response. From the sounds of your question, you changed your path of python. Normally you'll have a preinstalled version of python that is compatible with your OS. For example, CentOS 5.x comes with python 2.4, however you can do a yum install of python 2.6. Once installed, you can run python 2.6 by the python26 command.
When doing installs and packages, I would recommend that you try to use package managers as much as possible, as they help take care of your dependencies, such as yum. Yum also helps control updating packages instead of having to do updates manually. The next best thing is to do installs via pip or easy install, in the case of this question, you can try easy_install https://fedorahosted.org/releases/s/u/suds/python-suds-0.4.tar.gz (requires setuptools), and as a last resort, you can try to do the manual install. I if I get the point that I'm doing a manual install, I feel I failed somewhere :)
Others have given good detail on on how to do the install manually.
Good luck.