'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.



Solution 1:[1]

For python3:

sudo pip3 uninstall numpy

For python:

sudo pip uninstall numpy

or using:

sudo apt-get remove python-numpy

Solution 2:[2]

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

Solution 3:[3]

Try running it with root authorization

    sudo pip3 uninstall numpy

It should work, most of the times.

Solution 4:[4]

in your case

sudo apt remove python-numpy

and

sudo pip install numpy==[Version you need]

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tomerikoo
Solution 2 Tomerikoo
Solution 3 Lakshmi Narayanan
Solution 4 محمود طاهر