how to uninstall opencv-python package installed by using pip in anaconda?

I have tried to install OpenCV in anaconda. but when I use it, I figure out the instead of using OpenCV, the program using OpenCV-python and that why my program crashed. I type "conda uninstall opencv" but it just uninstalls OpenCV package not OpenCV-python. I also use " conda uninstall opencv-python" and "pip uninstall opencv-python" but it's not work.

  1. Go to directory where pip is installing your packages.
  2. You should able to see the egg file that corresponds to the package you want to uninstall. Delete the egg file (or, to be on the safe side, move it to a different directory).
  3. Do the same with the package files for the package you want to delete for (opencv-python)

In this short tutorial, I’ll show you how to use PIP to uninstall a package in Python. I’ll use a simple example to uninstall the pandas package. But before we begin, here is the generic form that you can use to uninstall a package in Python: pip uninstall package name Now, let’s suppose that you already installed the pandas package using

@Lê Huy Hùng

Please check official documentations before posting a question like this.

Here's the official documentation of pip uninstall

Here's how I uninstalled it

pip uninstall opencv-python

Uninstalling opencv-python-3.4.0.12: /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/QtCore /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/QtGui /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/QtTest /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/libavcodec.57.107.100.dylib /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/libavformat.57.83.100.dylib /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/libavresample.3.7.0.dylib /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/libavutil.55.78.100.dylib /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/libmp3lame.0.dylib /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/libswresample.2.9.100.dylib /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/.dylibs/libswscale.4.8.100.dylib /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/LICENSE-3RD-PARTY.txt /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/LICENSE.txt /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/init.py /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/pycache/init.cpython-35.pyc /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/cv2.cpython-35m-darwin.so /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/init.py /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/pycache/init.cpython-35.pyc /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_eye.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_eye_tree_eyeglasses.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_frontalcatface.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_frontalcatface_extended.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_frontalface_alt.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_frontalface_alt2.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_frontalface_alt_tree.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_frontalface_default.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_fullbody.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_lefteye_2splits.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_licence_plate_rus_16stages.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_lowerbody.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_profileface.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_righteye_2splits.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_russian_plate_number.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_smile.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/cv2/data/haarcascade_upperbody.xml /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/opencv_python-3.4.0.12.dist-info/DESCRIPTION.rst /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/opencv_python-3.4.0.12.dist-info/INSTALLER /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/opencv_python-3.4.0.12.dist-info/METADATA /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/opencv_python-3.4.0.12.dist-info/RECORD /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/opencv_python-3.4.0.12.dist-info/WHEEL /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/opencv_python-3.4.0.12.dist-info/metadata.json /Users/name/.virtualenvs/LT/lib/python3.5/site-packages/opencv_python-3.4.0.12.dist-info/top_level.txt Proceed (y/n)? y Successfully uninstalled opencv-python-3.4.0.12

To uninstall the package system-wide using pip, first uninstall it locally, then run the same uninstall command again, with root privileges. In addition to the predefined user install directory, pip install --target somedir somepackage will install the package into somedir. There is no way to uninstall a package from such a place using pip.

To uninstall I used this line of code and it worked,

    sudo pip uninstall opencv-python

Resulted as given:

Uninstalling opencv-python-4.0.0.21:   Would remove:

    c:\program files\anaconda3\lib\site-packages\cv2\*
    c:\program files\anaconda3\lib\site-packages\opencv_python-4.0.0.21.dist-info\* Proceed (y/n)? y   Successfully uninstalled opencv-python-4.0.0.21

I'm trying to uninstall numpy & then install a specific version of it on anaconda. However, the prompt also told that others packages will also uninstall itself. How do I uninstall only numpy packages? I'm using ubuntu 18.04.

According to official documentation, this issue must be solved quite easily:

pip uninstall opencv-python

Running conda after pip has the potential to overwrite and potentially break packages installed via pip. Similarly, pip may upgrade or remove a package which a conda-installed package requires. In some cases these breakages are cosmetic, where a few files are present that should have been removed, but in other cases the environment may evolve

Once the environment is resolved by conda it will list the packages that will be installed, namely pip install opencv-python. openCV for python on Windows using Anaconda as well as

Install Anaconda Editor and then install OpenCV Python with Anaconda using the pip command: "pip install opencv-python". Step by step process is provided.

The two pip OpenCV packages: opencv-python and opencv-contrib-python. Before we get started I want to remind you that the methods I’m coming here today are unofficial pre-built OpenCV packages that can be installed via pip — they are not official OpenCV packages released by OpenCV.org.

Comments
  • i can't find where pip is installing your packages, can you show me where is it in your computer
  • check in /usr/local/lib/python3.6/site-packages/ or /usr/lib/python3.6/site-packages/
  • you shouldn't need sudo to install or uninstall packages with pip.