Sean
Sean

Reputation: 333

Get UnsatisfiableError when Installing OpenCV for Python through Anaconda on Windows

I've tried installing OpenCV on Windows through Anaconda Navigator and Anaconda Prompt, but I get the same error:

UnsatisfiableError: The following specifications were found to be incompatible with each other:


Package hdf5 conflicts for:
pytables -> hdf5[version='>=1.10.1,<1.10.2.0a0,>=1.10.2,<1.10.3.0a0,>=1.10.4,<1.10.5.0a0,>=1.8.18,<1.8.19.0a0']
hdf5
opencv -> hdf5[version='>=1.10.2,<1.10.3.0a0,>=1.8.18,<1.8.19.0a0,>=1.8.20,<1.9.0a0']
anaconda==2019.03=py37_0 -> hdf5==1.10.4=h7ebc959_0
h5py -> hdf5[version='>=1.10.1,<1.10.2.0a0,>=1.10.2,<1.10.3.0a0,>=1.8.18,<1.8.19.0a0,>=1.8.20,<1.9.0a0']
Package mkl-service conflicts for:
mkl-service
Package zipp conflicts for:
importlib_metadata -> zipp[version='>=0.3.2,>=0.5']
zipp
anaconda==2019.03=py37_0 -> importlib_metadata==0.8=py37_0 -> zipp[version='>=0.3.2']
Package importlib_metadata conflicts for:
anaconda==2019.03=py37_0 -> importlib_metadata==0.8=py37_0

Upvotes: 9

Views: 8316

Answers (4)

prashant kumar shekhar
prashant kumar shekhar

Reputation: 136

I was even getting conflicts while trying to install opencv via conda. Therefore I tried to use the below pip command here to install opencv.

pip install opencv-python

You will see opencv starts getting installed on your system, the size is approx 37MB

To check the version of opencv and other installed packages

Use the command:

conda list

It will list all installed packages with their version number

To use opencv in python script, use the below import:

import cv2
print(cv2.__version__) #prints the version of opencv installed

Upvotes: 11

ZyJ
ZyJ

Reputation: 1

I was also encountered with the same problem like you. And I finally addressed it. You can firstly remove this package. Then install the OpenCV. During the course of installing the openCV, anaconda will help you install other realted packages again. Therefore, you need not to worry about lossing packages. And how to remove this package conflicted with opencv? You are recommanded to input "conda remove hdf5". Hope to help u!

Upvotes: 0

XC L
XC L

Reputation: 41

Anaconda 2019.07 , same problems , i figure it out ,that may help you.

try using conda update --all update your packages in Conda, then there will be some notifications, which means some packages need to be installed to satisfy the requests. just input 'y' to comfirm. y then opencv should be started installing after that use import cv2 cv2.__version__can print opencv's version '3.4.1'

Upvotes: 4

Carsten Eie Frigaard
Carsten Eie Frigaard

Reputation: 43

Removing hdf5 is not a good idea since it will also remove the jupyter packages:

> conda uninstall hdf5
Collecting package metadata (repodata.json): done
Solving environment: done
[..]
  removed specs:
    - hdf5
[..]
The following packages will be REMOVED:

  alabaster-0.7.12-py37_0
  anaconda-2019.07-py37_0
  anaconda-project-0.8.3-py_0
  [..]
  jupyter-1.0.0-py37_7
  jupyter_console-6.0.0-py37_0
  [..and a lot more]

It will remove 155 packages in total, among them the jupyter packages and you will then not be able to run Jupyter Notebooks, getting errors like

ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-1-c65cee9c4793> in <module>
      1 get_ipython().run_line_magic('clear', 'all')
----> 2 get_ipython().run_line_magic('matplotlib', 'inline')
      3 
      4 import numpy as np
      5 import cv2

I am currently also looking into the problem with opencv and Anaconda 2019.07; one alternative is to install Anaconda 2019.03 where opencv will only clash with a few other (unimportant) packages.

Upvotes: 0

Related Questions