Mona Jalal Mona Jalal - 1 year ago 643
Python Question

UnsatisfiableError: The following specifications were found to be in conflict: - opencv3 -> python 2.7* - python 3.6*

How to install OpenCV for Anaconda Python in OS X? I used the same command in Windows 7 Enterprise and it worked

Monas-MacBook-Pro:machine_learning mona$ conda install --channel https://conda.anaconda.org/menpo opencv3
Fetching package metadata .............
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
- opencv3 -> python 2.7*
- python 3.6*
Use "conda info <package>" to see the dependencies for each package.

Monas-MacBook-Pro:machine_learning mona$ conda install opencv3
Fetching package metadata ...........

PackageNotFoundError: Packages missing in current channels:

- opencv3

We have searched for the packages in the following channels:

- https://repo.continuum.io/pkgs/main/osx-64
- https://repo.continuum.io/pkgs/main/noarch
- https://repo.continuum.io/pkgs/free/osx-64
- https://repo.continuum.io/pkgs/free/noarch
- https://repo.continuum.io/pkgs/r/osx-64
- https://repo.continuum.io/pkgs/r/noarch
- https://repo.continuum.io/pkgs/pro/osx-64
- https://repo.continuum.io/pkgs/pro/noarch


Monas-MacBook-Pro:machine_learning mona$ conda install -c menpo opencv3
Fetching package metadata .............
Solving package specifications: .

UnsatisfiableError: The following specifications were found to be in conflict:
- opencv3 -> python 2.7*
- python 3.6*
Use "conda info <package>" to see the dependencies for each package.


Update: I even tried installing it using conda forge but I got this error

Monas-MacBook-Pro:machine_learning mona$ conda install -c conda-forge opencv
Fetching package metadata .............
Solving package specifications: ^[[A^[[B.

Package plan for installation in environment /Users/mona/anaconda:

The following NEW packages will be INSTALLED:

blas: 1.1-openblas conda-forge
bzip2: 1.0.6-1 conda-forge
ffmpeg: 3.2.4-1 conda-forge
x264: 20131217-3 conda-forge

The following packages will be UPDATED:

h5py: 2.7.0-np112py36_0 --> 2.7.1-py36_1 conda-forge
hdf5: 1.8.17-1 --> 1.8.18-1 conda-forge
numpy: 1.12.1-py36_0 --> 1.12.1-py36_blas_openblas_200 conda-forge [blas_openblas]
opencv: 3.2.0-np112py36_0 conda-forge --> 3.3.0-py36_blas_openblas_200 conda-forge [blas_openblas]
pytables: 3.3.0-np112py36_0 --> 3.4.2-np112py36_1 conda-forge
scikit-learn: 0.19.0-np112py36_0 --> 0.19.0-py36_blas_openblas_201 conda-forge [blas_openblas]
scipy: 0.19.1-np112py36_0 --> 0.19.1-py36_blas_openblas_202 conda-forge [blas_openblas]

The following packages will be SUPERSEDED by a higher-priority channel:

conda: 4.3.27-py36hb556a21_0 --> 4.3.24-py36_0 conda-forge
conda-env: 2.6.0-0 --> 2.6.0-0 conda-forge

Proceed ([y]/n)? y
Invalid choice: y
Proceed ([y]/n)? y

bzip2-1.0.6-1. 100% |#####################################################| Time: 0:00:00 395.79 kB/s
conda-env-2.6. 100% |#####################################################| Time: 0:00:00 993.59 kB/s
x264-20131217- 100% |#####################################################| Time: 0:00:02 1.19 MB/s
ffmpeg-3.2.4-1 100% |#####################################################| Time: 0:00:25 1.60 MB/s
hdf5-1.8.18-1. 100% |#####################################################| Time: 0:00:03 1.31 MB/s
blas-1.1-openb 100% |#####################################################| Time: 0:00:00 816.40 kB/s
numpy-1.12.1-p 100% |#####################################################| Time: 0:00:02 1.52 MB/s
h5py-2.7.1-py3 100% |#####################################################| Time: 0:00:00 1.78 MB/s
scipy-0.19.1-p 100% |#####################################################| Time: 0:00:10 1.55 MB/s
pytables-3.4.2 100% |#####################################################| Time: 0:00:02 1.19 MB/s
scikit-learn-0 100% |#####################################################| Time: 0:00:04 1.32 MB/s
conda-4.3.24-p 100% |#####################################################| Time: 0:00:00 1.59 MB/s
opencv-3.3.0-p 100% |#####################################################| Time: 0:00:22 1.64 MB/s
Monas-MacBook-Pro:machine_learning mona$ python
Python 3.6.2 |Anaconda custom (x86_64)| (default, Jul 20 2017, 13:14:59)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/mona/anaconda/lib/python3.6/site-packages/cv2.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libopenblasp-r0.2.19.dylib
Referenced from: /Users/mona/anaconda/lib/libopencv_core.3.3.dylib
Reason: image not found
>>>

Answer Source

This is an exact duplicate of this question from a few weeks ago. Just to copy/paste the answer:

Have a look at the list of conda installers for OpenCV in under the menpo package on Anaconda's package list:

osx-64/opencv3-3.1.0-py27_0.tar.bz2
osx-64/opencv3-3.1.0-py34_0.tar.bz2
osx-64/opencv3-3.1.0-py35_0.tar.bz2
linux-64/opencv3-3.1.0-py35_0.tar.bz2
linux-64/opencv3-3.1.0-py27_0.tar.bz2
linux-64/opencv3-3.1.0-py36_0.tar.bz2
linux-64/opencv3-3.1.0-py34_0.tar.bz2
linux-64/opencv3-3.2.0-np111py35_0.tar.bz2
linux-64/opencv3-3.2.0-np111py34_0.tar.bz2
linux-64/opencv3-3.2.0-np111py27_0.tar.bz2
win-32/opencv3-3.1.0-py27_0.tar.bz2
win-64/opencv3-3.1.0-py35_0.tar.bz2
win-32/opencv3-3.1.0-py35_0.tar.bz2
win-64/opencv3-3.1.0-py34_0.tar.bz2
win-32/opencv3-3.1.0-py34_0.tar.bz2
win-64/opencv3-3.1.0-py27_0.tar.bz2

Notice the Python versions listed in each installer. For macOS, the newest menpo installer is OpenCV 3.1.0 and works on Python 3.5. So if you want to use the menpo installer, simply create a new environment with Python 3.5, activate, and then install:

conda create -n <opencv virtual env> python=3.5
source activate <opencv virtual env>
conda install -c menpo opencv3

Otherwise if you want to use Python 3.6 (which is a really great Python release), you'll need to build from source. See the great answer from this Stack Overflow question: Can't install OpenCV3 on Anaconda3 python3.6 on macOS.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download