Reputation: 843
I'm trying to uninstall numpy
, but I get a permission error:
(base) tfovid@tfovid-t777s:~/codebase$ pip uninstall numpy
Found existing installation: numpy 1.19.5
Uninstalling numpy-1.19.5:
Would remove:
/usr/bin/f2py3
/usr/bin/f2py3.9
/usr/lib/python3/dist-packages/numpy
/usr/lib/python3/dist-packages/numpy-1.19.5.egg-info
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.9/shutil.py", line 806, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/bin/f2py3' -> '/tmp/pip-uninstall-mzc7w25e/f2py3'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tfovid/.local/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 180, in _main
status = self.run(options, args)
File "/home/tfovid/.local/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py", line 85, in run
uninstall_pathset = req.uninstall(
File "/home/tfovid/.local/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 672, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/home/tfovid/.local/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py", line 386, in remove
moved.stash(path)
File "/home/tfovid/.local/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py", line 275, in stash
renames(path, new_path)
File "/home/tfovid/.local/lib/python3.9/site-packages/pip/_internal/utils/misc.py", line 324, in renames
shutil.move(old, new)
File "/usr/lib/python3.9/shutil.py", line 821, in move
os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/bin/f2py3'
I thought that sudo privileges would fix it but to no avail:
(base) tfovid@tfovid-t777s:~/codebase$ sudo pip uninstall numpy
[sudo] password for tfovid:
Found existing installation: numpy 1.19.5
Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'numpy'. No files were found to uninstall.
(base) tfovid@tfovid-t777s:~/codebase$ sudo apt remove python-numpy
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python-numpy
What could possibly the reason for this and how to solve it?
Upvotes: 0
Views: 3556
Reputation: 843
I found out that I had to specify Python 3, so sudo apt remove python3-numpy
ended up working.
Upvotes: 3