OSError: [Errno 13] Permission denied when updating setuptools - python

I'm trying to update setuptools using homebrew but I keep getting an error that says:
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/setuptools-1.1.3-py2.7.egg'
How do I allow my computer to make changes to that file so I can update setuptools?

I figured out how to fix it! I looked up the name of that file setuptools-0.6c11-py2.7.egg and I found a python page on it that says
NOTE: Regardless of what sort of Python you're using, if you've previously installed older versions of setuptools, please delete all setuptools*.egg and setuptools.pth files from your system's site-packages directory (and any other sys.path directories) FIRST.
So I deleted setuptools-0.6c11-py2.7.egg and setuptools.pth in /Library/Python/2.7/site-packages/ then I went into terminal and typed in pip install --upgrade setuptools and it worked!

Open Finder and select Go - Go To Folder. Then hit Command-I, and at the bottom under Sharing and Permissions, add yourself with Read and Write Access. This should solve it.

Related

python error No such file or directory while installing a package

I wanted to install a statistics package called pmdarima. I used
pip install pmdarima
I received the error message:
ERROR: Could not install packages due to an EnvironmentError: [Errno
2] No such file or directory:
‘C:\Programs\Miniconda3_x64\jup369\Lib\site-packages\numpy\conftest.py
but I saw the file conftest.py in that directory!
Does anyone know what this error means?
It looks like your path might be too long. See this link to question 54778630 for details. Try installing to a folder with a shorter path. Here is another guide that offers some more things to try.

Cannot install python by requirements.txt

I try to install the python package using the following command line in anacondaprompt:
(base) C:\Users\Lenovo>pip install -r D:\autoencoder\Website_by_python\requirements.txt
Then the error is shown as
Processing c:\tmp\build\80754af9\backports.functools_lru_cache_1618170165463\work
ERROR: Could not install packages due to an OSError: [Errno 2] No such file or directory: 'C:\\tmp\\build\\80754af9\\backports.functools_lru_cache_1618170165463\\work'
I don't really know how to deal with that error. Could you please tell me?
Could not install packages due to an OSError
is always related to administrator privileges or even worse the python version that visual studio installs by default i suggest you to
uninstall python
delete the python extension from vs code
delete the python version in the data folder you can access it by run %temp% and in the address bar click on app data from there look for python
finally reinstall python i suggest you directly to C: without any version numbers i.e c:/Python dont forget to click add variables to path then open visual studio again and let him install the python extension again
omg i just noticed you talk about anaconda nevertheless it should be exactly the same problem

WinError 5: Access Denied using setuptools, even with admin and virtual env

I am having something like this issue but none of the answers worked for me. I have my own package and I am trying to install it on Windows using
python setup.py install
It is a pretty typical/minimal setup.py, nothing special. I am using a conda environment. I get the famous WinError 5: Access Denied when it is trying to extract stuff from the egg and put it in my site-packages.
<... other install noise ...>
creating 'dist\mypackage-1.0-py3.8.egg' and adding 'build\bdist.win-amd64\egg' to it
removing 'build\bdist.win-amd64\egg' (and everything under it)
Processing mypackage-1.0-py3.8.egg
creating c:\users\user1\.conda\envs\myenv\lib\site-packages\mypackage-1.0-py3.8.egg
Extracting mypackage-1.0-py3.8.egg to c:\users\user1\.conda\envs\myenv\lib\site-packages
error: [WinError 5] Access is denied:
'c:\\users\\user1\\.conda\\envs\\myenv\\lib\\site-packages\\mypackage-1.0-py3.8.egg\\mypackage\\__pycache__\\my_module.cpython-38.pyc.1481939376624' -> 'c:\\users\\user1\\.conda\\envs\\myenv\\lib\\site-packages\\mypackage-1.0-py3.8.egg\\mypackage\\__pycache__\\my_moduel.cpython-38.pyc'
I have checked every folder in the path to the install location (.conda\envs\myenv\Lib\site-packages\) and they are all owned by me with full control. Using an admin terminal did not solve the problem. I searched the MacAfee logs and did not see anything indicating that it was the culprit.
I solved this by instead creating a wheel file and installing it via pip. This works in my environment and does not require admin privileges:
python setup.py bdist_wheel
cd dist\
pip install mypackage-py3-none-any.whl --force
It seems like there is some deeper bug here with setuptools or whatever that is copying the files from the egg over to site-packages. Posting here to help anyone else who is hopelessly googling this issue without luck. Is this a bug that should be reported?

Could not install tweepy, a python library in Ubuntu 16.04 in a remote host allocated by LONI using pip and easy_install

Whenever I try to install tweepy, a python library inside a remote host, it fails, although I have pip and python of appropriate version installed. My python version is anaconda 2.7.13 and pip version is 9.0.1. Thanks in advance!
So, I have tried the following commands below and none of them worked.
pip install tweepy
pip install --user tweepy
It gives the error:
Traceback (most recent call last):
File "/usr/local/packages/python/2.7.10-anaconda/bin/pip", line 6, in <module>
sys.exit(pip.main())
File "/usr/local/packages/python/2.7.10-anaconda/lib/python2.7/site-packages/pip/__init__.py", line 239, in main
ensure_easy_pth()
File "/usr/local/packages/python/2.7.10-anaconda/lib/python2.7/site-packages/pip/__init__.py", line 217, in
ensure_easy_pth
with open(path, 'w') as fo:
IOError: [Errno 13] Permission denied: '/usr/local/packages/python/2.7.10-anaconda/lib/python2.7/site-packages/easy-install.pth'
When I try to use easy_install:
easy_install tweepy
It gives the 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 13] Permission denied: '/usr/local/packages/python/2.7.10-anaconda/lib/python2.7/site-packages/test-easy-install-40557.write-test'
The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:
/usr/local/packages/python/2.7.10-anaconda/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:
https://setuptools.readthedocs.io/en/latest/easy_install.html
Please make the appropriate changes for your system and try again.

How to change path to site-packages dir in easy_install

I'm trying to use easy_install on windows7x64 and getting this:
<output>
c:\Python27\Scripts>easy_install.exe django-piston
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: 'C:\\Python27\\Lib\\site-packages\\Lib\
\site-packages\\test-easy-install-4132.pth'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:\Python27\Lib\site-packages\Lib\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).
Where can I change easy_install's path to correct one "C:\Python27\Lib\site-packages"?
easy_install should install the packages in the Python installation's site-packages directory. It could have happened that you changed Python's directory accidentally.
Reinstalling easy_install should fix this.
Otherwise you could use:easy_install --install-dir C:\Python27\Lib\site-packages\Lib\site-packages\ django-piston
However, this last option has two issues:
Make sure C:\Python27\Lib\site-packages\Lib\site-packages\ is in PYTHONPATH
You will need to indicate a install-dir directory for every new package you install

Categories