Christos Hadjinikolis
Christos Hadjinikolis

Reputation: 2158

Installing opencv-3.1.0 on MacOS Sierra to use with python

I recently upgraded to MacOS Sierra and I have been dealing with many issues (I am mentioning it cause it may be relevant). I am trying to install opencv-3.1.0 to use with python 2.7. and it's been impossible. I downloaded opencv-3.1.0 from here unzipped it and ran:

python platforms/osx/build_framework.py osx

from the opencv-3.1.0 directory. Don't want to print all of the output, so here is just the Error message.

** BUILD FAILED **


The following build commands failed:
    CompileC osx/build/x86_64-MacOSX/modules/world/OpenCV.build/Release/opencv_world.build/Objects-normal/x86_64/cap_qtkit.o modules/videoio/src/cap_qtkit.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
============================================================
ERROR: Command '['xcodebuild', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '4', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65
============================================================
Traceback (most recent call last):
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 87, in build
    self._build(outdir)
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 81, in _build
    self.buildOne(t[0], t[1], mainBD, cmake_flags)
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 139, in buildOne
    execute(buildcmd + ["-target", "ALL_BUILD", "build"], cwd = builddir)
  File "/Users/christoshadjinikolis/Downloads/opencv-3.1.0/platforms/ios/build_framework.py", line 34, in execute
    retcode = check_call(cmd, cwd = cwd)
  File "/Users/christoshadjinikolis/anaconda/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '['xcodebuild', 'ARCHS=x86_64', '-sdk', 'macosx', '-configuration', 'Release', '-parallelizeTargets', '-jobs', '4', '-target', 'ALL_BUILD', 'build']' returned non-zero exit status 65

Would appreciate your help. Thanks.

Upvotes: 0

Views: 5991

Answers (2)

razimbres
razimbres

Reputation: 5015

Try:

conda create -n opencv python=2

source activate opencv

conda install -c conda-forge opencv==3.1.0

Upvotes: 0

Christos Hadjinikolis
Christos Hadjinikolis

Reputation: 2158

After following the post here I was able to install it just fine by running:
brew install opencv3 --HEAD --with-contrib

The issue appears to be related with the QuickTime codecs. You need to specify that the library is installed with ffmpeg instead and it should work.

brew install opencv3 --with-ffmpeg --with-tbb --with-contrib

Upvotes: 1

Related Questions