title: How to uninstall pip opencv-python from Anaconda on Windows 10?
body: <p>I wanted to ask a specific question before I try anything else and possibly ruin my Anaconda distribution.</p>
  
  <pre><code>conda version: 4.7.11
  anaconda version: 2019.07
  python version: 3.7.3
  </code></pre>
  
  <p>I installed <code>opencv-python</code> per the instructions <a href="https://stackoverflow.com/questions/42994813/installing-opencv-on-windows-10-with-python-3-6-and-anaconda-3-6">here</a>:</p>
  
  <pre><code>(base) C:\Users\...&gt;pip install opencv-python
  </code></pre>
  
  <p>I thought this had worked because I was able to run defs from <code>import cv2</code> in my Spyder IDE, and <code>conda list</code> returned:</p>
  
  <pre><code>...
  numpydoc                  0.9.1                      py_0
  olefile                   0.46                     py37_0
  opencv-python             4.1.1.26                 pypi_0    pypi
  openpyxl                  2.6.2                      py_0
  ...
  </code></pre>
  
  <p>However, I quickly ran into problems when attempting the <a href="https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_image_display/py_image_display.html" rel="nofollow noreferrer">tutorial</a>. Specifically, <code>img = cv2.imread('messi5.jpg',0)</code> would return a <code>None</code> object. I tried <code>img = cv2.imread(r'C:\path_to_my_image.jpg',0)</code> with a local photo, and it correctly returned a 2D, grayscale object array. I'm confident I simply failed to install the photo library that comes with opencv.</p>
  
  <p>I anticipated more problems and did some digging, where I found <a href="https://stackoverflow.com/a/40016776/10103422">this</a> answer shows that I probably did not install the correct version of cv. I attempted to uninstall using <code>pip</code>, but had a text file from the active directory open, and got a permission error!</p>
  
  <pre><code>(base) C:\Users\triton&gt;pip uninstall opencv-python
  Uninstalling opencv-python-4.1.1.26:
    Would remove:
      c:\users\triton\anaconda3\lib\site-packages\cv2\*
      c:\users\triton\anaconda3\lib\site-packages\opencv_python-4.1.1.26.dist-info\*
  Proceed (y/n)? y
  ERROR: Exception:
  Traceback (most recent call last):
    File "C:\Users\triton\Anaconda3\lib\shutil.py", line 563, in move
      os.rename(src, real_dst)
  PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'c:\\users\\triton\\anaconda3\\lib\\site-packages\\opencv_python-4.1.1.26.dist-info\\' -&gt; 'c:\\users\\triton\\anaconda3\\lib\\site-packages\\~pencv_python-4.1.1.26.dist-info'
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "C:\Users\triton\Anaconda3\lib\site-packages\pip\_internal\cli\base_command.py", line 178, in main
      status = self.run(options, args)
    File "C:\Users\triton\Anaconda3\lib\site-packages\pip\_internal\commands\uninstall.py", line 75, in run
      auto_confirm=options.yes, verbose=self.verbosity &gt; 0,
    File "C:\Users\triton\Anaconda3\lib\site-packages\pip\_internal\req\req_install.py", line 823, in uninstall
      uninstalled_pathset.remove(auto_confirm, verbose)
    File "C:\Users\triton\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 388, in remove
      moved.stash(path)
    File "C:\Users\triton\Anaconda3\lib\site-packages\pip\_internal\req\req_uninstall.py", line 277, in stash
      renames(path, new_path)
    File "C:\Users\triton\Anaconda3\lib\site-packages\pip\_internal\utils\misc.py", line 305, in renames
      shutil.move(old, new)
    File "C:\Users\triton\Anaconda3\lib\shutil.py", line 575, in move
      rmtree(src)
    File "C:\Users\triton\Anaconda3\lib\shutil.py", line 513, in rmtree
      return _rmtree_unsafe(path, onerror)
    File "C:\Users\triton\Anaconda3\lib\shutil.py", line 401, in _rmtree_unsafe
      onerror(os.rmdir, path, sys.exc_info())
    File "C:\Users\triton\Anaconda3\lib\shutil.py", line 399, in _rmtree_unsafe
      os.rmdir(path)
  PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'c:\\users\\triton\\anaconda3\\lib\\site-packages\\opencv_python-4.1.1.26.dist-info\\'
  </code></pre>
  
  <p>I closed the text file and tried to run <code>pip uninstall opencv-python</code> again, but now receive:</p>
  
  <pre><code>(base) C:\Users\triton&gt;pip uninstall opencv-python
  WARNING: Skipping opencv-python as it is not installed.
  </code></pre>
  
  <p>I do not know if this warning is accurate, because <code>conda list</code> still shows <code>opencv-python</code> as an available package:</p>
  
  <pre><code>...
  olefile                   0.46                     py37_0
  opencv-python             4.1.1.26                 pypi_0    pypi
  openpyxl                  2.6.2                      py_0
  openssl                   1.1.1c               he774522_1
  ...
  </code></pre>
  
  <p>i finally tried <code>conda remove opencv-python</code> but it says the packages aren't found?!</p>
  
  <pre><code>(base) C:\Users\triton&gt;conda remove opencv-python
  Collecting package metadata (repodata.json): done
  Solving environment: failed
  
  PackagesNotFoundError: The following packages are missing from the target environment:
    - opencv-python
  </code></pre>
  
  <p>I want to perform a clean <code>opencv3</code> install via <a href="https://stackoverflow.com/a/54405706/10103422">this</a> method, but don't know if there will be some library conflicts or something. I am severely confused about what's happening here, and wanted to get advice before trying to alter my distribution any further. It's not the end of the world if I need to reinstall Anaconda entirely, but I thought i would share these problems in case someone else runs into them!</p>
  
  <p>How can I be sure all opencv pip files are completely removed, without doing a clean reinstall of Anaconda?</p>
  
  <p>Thanks in advance for your help!</p>