21

I looked this up online but they're all suggesting using sudo command I used

sudo pip uninstall numpy

I get this message:

Not uninstalling numpy at /usr/lib/python2.7/dist-packages, outside environment /usr

I installed it using pip , not apt .

The output of :

 $ dpkg -S /usr/lib/python2.7/dist-packages/numpy
 python-numpy: /usr/lib/python2.7/dist-packages/numpy

PS: I'm a mac user, I usually use homebrew for my installations, so I'm an amateur in Ubuntu

3
  • did you install it using sudo pip install numpy or using pip install numpy?
    – Yaron
    Jun 19, 2017 at 7:18
  • 1
    Post the output of dpkg -S /usr/lib/python2.7/dist-packages/numpy please.
    – Ravexina
    Jun 19, 2017 at 7:20
  • using sudo pip install numpy
    – momo12321
    Jun 19, 2017 at 7:20

8 Answers 8

23

According to the output of dpkg -S, numpy has been installed using apt to remove it run:

sudo apt remove python-numpy

you might have a local installation of it using pip, to remve that you can use:

pip uninstall numpy --user
9
  • Wouldn't pip remove numpy --user make a clash with pip of miniconda2?
    – momo12321
    Jun 19, 2017 at 7:24
  • As far as I know, no... miniconda environment is separate from pip.
    – Ravexina
    Jun 19, 2017 at 7:26
  • 1
    I uninstalled it using sudo apt, however when I run sudo pip list I still get numpy in the list .
    – momo12321
    Jun 19, 2017 at 7:30
  • Now try removing it using sudo pip remove numpy, it should work now.
    – Ravexina
    Jun 19, 2017 at 7:31
  • 1
    There is no --user option, even after updating. However, --isolated worked.
    – Alish
    Feb 19 at 5:36
3

use --isolated option.

like below:

sudo pip uninstall numpy --isolated

1

Try running with sudo but passing the python path in the command:

sudo PYTHONPATH=/usr/bin/ pip uninstall numpy -y

I was having trouble to uninstall some packages due to a lack of permission

PermissionError: [Errno 13] Permission denied: '/usr/local/bin/runlike'

and when inserting sudo in the command, it was looking for python packages in the wrong directory.

Another tip is to make sure if you're using pip or pip3 !

To check if something is still in the machine, run

dpkg -l | grep python

And uninstall any package you see is still there using apt

sudo apt remove python-nympy
sudo apt clean && sudo apt autoremove

Hope it helps!

0

I had the same problem. I solved it when I deleted a file to which I had given the name numpy.py.

1
  • 2
    "I solved it when I deleted a file" is really not a helpful answer to others unless you explain what file needed to be deleted along with the file path. You should consider editing your answer to make sure that it offers a solution that others can apply.
    – Nmath
    Oct 27, 2020 at 0:31
0

I sovled the problem by editing /usr/lib/python3/dist-packages and manually removing the two directories associated with numpy.

After that I reinstalled the packages using

pip install numpy
0

I faced a similar problem with tartube package and it is a python package, I tried hard to remove that package but it always seems like it is not found, but I finally find a perfect solution and I hope it will be useful for you.

  1. First I searched for the package using this command:

    $ dpkg -l | grep python

  2. Then I found the python- followed by package name: Search result of python packages

    ii python3-tartube 2.3.332-1 all GUI front-end for youtube-dl

  3. Then I used the dpkg with superuser privilege to remove it using this command:

    sudo dpkg --remove python3-tartube

  • I hope this will be useful, also I want to share a picture of numpy, it's found on the pyhton package search numpy search result
0

I had this problem with juypter notebooks. Turns out that i had it installed globally and when i ran jupyter it was calling the global one instead of the one in the environment (or didn't instal into the venv coz it thought it was already installed, or something). So

  1. uninstalling it outside the the venv
  2. activate the venv and installing worked for me
0

Only this above tip helped:

sudo apt remove python3-numpy 

->

The following packages were automatically installed and are no longer required:
  libjs-jquery-ui python-matplotlib-data python3-kiwisolver
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  python3-matplotlib python3-numpy
0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded.
After this operation, 28.3 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 389330 files and directories currently installed.)
Removing python3-matplotlib (3.1.2-1ubuntu4) ...
Removing python3-numpy (1:1.17.4-5ubuntu3) ...

and then reinstalling as a user:

pip3 install numpy 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.