OSError: [Errno 13] Permission denied - python

I am new to using command line and apologize in advance for any confusion.
I am trying to install STAMP but I get an Errno 13 Permission denied as response.
Found existing installation: scipy 0.13.0b1
DEPRECATION: Uninstalling a distutils installed project (scipy) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling scipy-0.13.0b1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/basecommand.py", line 246, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/commands/install.py", line 352, in run
root=options.root_path,
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_set.py", line 687, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_install.py", line 730, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_uninstall.py", line 126, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg/pip/utils/__init__.py", line 292, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
os.unlink(src)
OSError: [Errno 13] Permission denied: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy-0.13.0b1-py2.7.egg-info'
I know this issue has been covered in depth but I cannot figure out how to apply the answers to my specific problem.
Any ideas?
Thank you in advance
TVAN

sudo pip install STAMP
whenever you see the phrase like this:"Permission denied", you should look up for this command.

Related

Cannot uninstall numpy,

I'm trying to use pip to uninstall numpy(I also installed pandas, but I seem to have been able to uninstall that). In the case of `numpy, I get the following output.
pip3 uninstall numpy -vvv --log pip.txt
Uninstalling numpy-1.12.1:
/usr/lib64/python3.6/site-packages/numpy
/usr/lib64/python3.6/site-packages/numpy-1.12.1-py3.6.egg-info
Removing file or directory /usr/lib64/python3.6/site-packages/numpy
Exception:
Traceback (most recent call last):
File "/usr/lib64/python3.6/shutil.py", line 544, in move
os.rename(src, real_dst)
OSError: [Errno 18] Invalid cross-device link: '/usr/lib64/python3.6/site-packages/numpy' -> '/tmp/pip-odkg0wo0-uninstall/usr/lib64/python3.6/site-packages/numpy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.6/site-packages/pip/commands/uninstall.py", line 76, in run
requirement_set.uninstall(auto_confirm=options.yes)
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 346, in uninstall
req.uninstall(auto_confirm=auto_confirm)
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/usr/lib/python3.6/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/usr/lib64/python3.6/shutil.py", line 556, in move
rmtree(src)
File "/usr/lib64/python3.6/shutil.py", line 480, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib64/python3.6/shutil.py", line 418, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib64/python3.6/shutil.py", line 438, in _rmtree_safe_fd
onerror(os.unlink, fullname, sys.exc_info())
File "/usr/lib64/python3.6/shutil.py", line 436, in _rmtree_safe_fd
os.unlink(name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'multiarray_tests.cpython-36m-x86_64-linux-gnu.so'
I've got a Fedora 26 system running both Python 2.7.15 and Python 3.6.5
I'm very new to Python (just started learning it last night), so forgive the ignorance. I've seen several related questions (mostly dealing with pip installs rather than uninstalls. None of them seemed to solve the issue. I should also note that I've read in these other posts that running pip as sudo is a bad idea (something I did while trying to install pandas because I didn't have permissions (and again, I read later on that that is a bad idea). Any help here is appreciated.
For python3:
sudo pip3 uninstall numpy
For python:
sudo pip uninstall numpy
or using:
sudo apt-get remove python-numpy
I had a similar problem with numpy and I just had to remove the package using apt (In your case is yum).
Try to do:
sudo yum remove python3-numpy
Try running it with root authorization
sudo pip3 uninstall numpy
It should work, most of the times.
in your case
sudo apt remove python-numpy
and
sudo pip install numpy==[Version you need]

Installation of Neomodel raised error

I'm trying to install the library Neomodel to use Neo4j in my Django application but it raised many errors:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
copytree(src, real_dst, symlinks=True)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pytz/__init__.py', '/tmp/pip-rVZOK9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pytz/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-rVZOK9-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pytz/__init__.py'")
There errors message is a lot of longer but I reduced it to be more concise. Also all the error are the same (Permission Denied). I try to install it using the command:
sudo pip install neomodel
I have never seen such an error and really don't know what to do to fix. Any help would be welcome.
You should avoid using sudo with pip.
You can run pip install neomodel --user to run without a virtualenv but it's generally a good practice to use a virtualenv instead.

sudo pip install django-nose: "no such file or directory" followed by an empty string?

When trying to sudo pip install django-nose, I get a strange error:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/basecommand.py", line 232, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/commands/install.py", line 347, in run
root=options.root_path,
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_set.py", line 549, in install
**kwargs
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 754, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/req/req_install.py", line 963, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 266, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/usr/local/lib/python2.7/site-packages/pip-6.0.8-py2.7.egg/pip/wheel.py", line 176, in clobber
os.makedirs(dest)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 2] No such file or directory: ''
I am only using sudo because without sudo, I get a IOError: [Errno 13] Permission denied: '/lib/python2.7/site-packages/nose/__init__.py'. Here is what I get for which Python and pip is being used, which I think are both what I want them to be:
$ which python
/usr/local/bin/python
$ which pip
/usr/local/bin/pip
This is a separate issue, but I wonder if it's related: I also get this error while trying to create a virtualenv: IOError: [Errno 13] Permission denied: '/lib/python2.7/site-packages/easy_install.py'
I recently upgraded to El Capitan, and it seems like there were some permissions changes that may have caused it to suddenly not work even though it has been working for a while. (Although I'll admit I'm not super experienced here, so I could be doing something very obviously wrong.) I just have no idea how to even decipher this error, and obviously I don't want to do any chmod or chown on system files unless I absolutely know it will solve my problem. Any suggestions would be greatly appreciated!

pip freeze is giving me the global packages

I'm fairly new to python so please bear with me. I installed the virtual env created a new environment and everything very smooth(great). so when I try to pip freeze it gives me all the global packages that are installed and not only the environment im in. Then I try to install django and it does not let me. This is the error that gives me...
→ pip install django
Collecting django
Downloading Django-1.9.5-py2.py3-none-any.whl (6.6MB)
100% |████████████████████████████████| 6.6MB 187kB/s
Installing collected packages: django
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_set.py", line 732, in install
**kwargs
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 1030, in move_wheel_files
isolated=self.isolated,
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/wheel.py", line 344, in move_wheel_files
clobber(source, lib_dir, True)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/wheel.py", line 315, in clobber
ensure_dir(destdir)
File "/Library/Python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/django'
OK. I got it working. The problem was something with a cache directory. When I reinstalled virtualenv I used a flag plus sudo.
sudo pip install --no-cache-dir virtualenv
but new questions comes up.
How important is a cache directory for the environments?
Do I need one yes o no?
Thanks all for your awesome help.

Cannot pip install anything with OS X El Capitan

I am trying to pip install virtualenv (and anything else) on OS X El Capitan and got the following error:
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/pip/basecommand.py", line 211, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/pip/commands/install.py", line 311, in run
root=options.root_path,
File "/usr/local/lib/python2.7/site-packages/pip/req/req_set.py", line 646, in install
**kwargs
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 803, in install
self.move_wheel_files(self.source_dir, root=root)
File "/usr/local/lib/python2.7/site-packages/pip/req/req_install.py", line 998, in move_wheel_files
isolated=self.isolated,
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 339, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/site-packages/pip/wheel.py", line 282, in clobber
ensure_dir(dest) # common for the 'include' path
File "/usr/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 71, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 1] Operation not permitted: '/usr/lib/python2.7/site-packages'
Looks pip is trying to write in '/usr/lib/python2.7/site-packages' and due to SIP in El Capitan it got denied.
But I was wondering why does pip needs to write there? How can I fix this?
I ran brew doctor
which gives
Your system is ready to brew.
So I think it is OK.
I tried brew reinstall python and it gives an odd error:
==> Reinstalling python
Error: /usr/local/opt/python is not a valid keg
which python gives
/usr/local/bin/python
So where in system has this weird thing that let pip fail
Update:
It looks my pip is pointing to system python rather than brewed python.
I changed the first line of pip to
#!/usr/local/bin/python
and problem is solved
You may need to brew link python, or unlink then link to get things pointing to the correct places.

Categories

Resources