0

I want to use some function of ximgproc, so I uninstalled opencv-python and re-installed opencv-contrib-python

(venv) C:\Users\Administrator\PycharmProjects\eps>pip uninstall opencv-contrib-python opencv-python
Skipping opencv-contrib-python as it is not installed.
Uninstalling opencv-python-4.5.1.48:
  Would remove:
    c:\users\administrator\pycharmprojects\eps\venv\lib\site-packages\cv2\*
    c:\users\administrator\pycharmprojects\eps\venv\lib\site-packages\opencv_python-4.5.1.48.dist-info\*
Proceed (y/n)? y
  Successfully uninstalled opencv-python-4.5.1.48

(venv) C:\Users\Administrator\PycharmProjects\eps>pip install opencv-contrib-python
Collecting opencv-contrib-python
  Using cached https://files.pythonhosted.org/packages/01/07/4da5e3a2262c033bd10d7f6275b6fb6c77396b2058cedd02e61dbcc4a56d/opencv_contrib_python-4.5.1.48-cp36-cp36m-win_amd64.whl
Requirement already satisfied: numpy>=1.13.3 in c:\users\administrator\pycharmprojects\eps\venv\lib\site-packages (from opencv-contrib-python) (1.18.2)
Installing collected packages: opencv-contrib-python
Successfully installed opencv-contrib-python-4.5.1.48

However, I could not import ximgproc still. Is there anything I forgot ?

MooNChilD Song
  • 225
  • 1
  • 9

2 Answers2

0

Can you check which packages you have intalled with pip list? Even though you uninstalled opencv-python, you also need to uninstall opencv-python-headless, opencv-contrib-python-headless packages. As @skvark says

never install both package

Ceopee
  • 316
  • 4
  • 12
  • oauthlib 3.1.0 open3d 0.10.0.1 opencv-contrib-python 4.5.1.48 opencv-python 4.5.1.48 opt-einsum 3.2.0 packaging 20.4 pandocfilters 1.4.2 – MooNChilD Song Jan 14 '21 at 03:34
  • I cropped O part and will try to install contrib only – MooNChilD Song Jan 14 '21 at 03:35
  • It's weird you couldn't uninstall even though you have done it before. Try again to uninstall `opencv-python 4.5.1.48` , otherwise you can try to delete manually: https://stackoverflow.com/a/14572899/14950238 – Ceopee Jan 14 '21 at 07:17
-1

Install opencv and opencv-contrib modules separately.
Command for standard desktop environment:

$ pip install opencv-python opencv-contrib-python
Ankush Chavan
  • 1,043
  • 1
  • 6
  • 20
  • 2
    You should never install both packages. Only the latter will be actually installed and it overwrites the first one. It also makes your environment inconsistent since `pip` will show that `opencv-python` is installed but in reality it has been overwritten by `opencv-contrib-python`. – skvark Jan 13 '21 at 11:59