7

I am trying to install opencv on a Macbook Pro late 2013 with mavericks. I didn't find any binaries so I am trying to build it.
I tried http://www.guidefreitas.com/installing-opencv-2-4-2-on-mac-osx-mountain-lion-with-python-support
and http://forums.udacity.com/questions/100021223/installing-opencv-on-os-x-mountain-lion
when calling make the error 2 is produced
(CMake Error at cuda_compile_generated_matrix_operations.cu.o.cmake:208)

When searching on this website I found opencv for python on mavericks (I also tried homebrew which also produced error 2, but without any further information)

I googled a lot, but none of the found solutions worked for me. Does anyone have a tut for installing opencv on Mavericks?

Thank you

using brew gives the following output:

    brew install homebrew/science/opencv
    Warning: It appears you have MacPorts or Fink installed.
    Software installed with other package managers causes known problems for
    Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
    ==> Downloading http://downloads.sourceforge.net/project/opencvlibrary/opencv-un
    Already downloaded: /Library/Caches/Homebrew/opencv-2.4.6.1.tar.gz
    ==> cmake -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/opencv/2.4.6.1 -DCMAKE_BUILD_
    ==> make
    cd /tmp/opencv-QBoi/opencv-2.4.6.1/macbuild/modules/stitching && /usr/local/Cellar/cmake/2.8.12/bin/cmake -E cmake_symlink_library ../../lib/libopencv_stitching.2.4.6.dylib ../../lib/libopencv_stitching.2.4.dylib ../../lib/libopencv_stitching.dylib
    /usr/local/Cellar/cmake/2.8.12/bin/cmake -E cmake_progress_report /tmp/opencv-QBoi/opencv-2.4.6.1/macbuild/CMakeFiles  90 91
    [100%] Built target opencv_stitching
    make[1]: *** [modules/python/CMakeFiles/opencv_python.dir/all] Error 2
    make: *** [all] Error 2

    READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
    If reporting this please do so at the homebrew/science tap (not mxcl/homebrew).

I solved the problem for me by using canopy (https://www.enthought.com/products/canopy/) which is free for students

Community
  • 1
  • 1
Peter Burkert
  • 461
  • 4
  • 13

2 Answers2

5

You can install it with brew normally.

brew install homebrew/science/opencv

or

brew tap homebrew/science
brew install opencv

This is how I installed it on my mavericks and it worked fine.

Neil Traft
  • 18,367
  • 15
  • 63
  • 70
  • output in the first post – Peter Burkert Nov 11 '13 at 11:45
  • mmm, do you have more than 1 python version installed? –  Nov 11 '13 at 12:18
  • ok, just found out that in /usr/bin there are several python versions: 2.5, 2.6, 2.7 could that be the problem? – Peter Burkert Nov 11 '13 at 13:14
  • No that's normal, Apple provides these version by default. I'm not sure what's your problem, did you google that error from brew? –  Nov 11 '13 at 13:19
  • i tried googling [modules/python/CMakeFiles/opencv_python.dir/all] Error 2, but that didn't bring anything useful. – Peter Burkert Nov 11 '13 at 13:34
  • Check [this](http://stackoverflow.com/questions/17287250/install-opencv-for-python-multiple-python-versions) No need for Numpy (last 1), just the ones before. –  Nov 11 '13 at 13:35
  • to do so i need to use make instead of brew. That produces the above named error: [modules/core/CMakeFiles/opencv_core.dir/all] Error 2 (it also says clang: error: unsupported option '-dumpspecs') – Peter Burkert Nov 11 '13 at 14:07
  • I have same problem... (Mavericks, Anaconda Python distribution). Are you using Mac version of Python? U might try to use homebrew version of python. – tabchas Nov 14 '13 at 22:41
  • For those getting `Invalid usage` when using the `brew tap` command, try this instead: `brew tap homebrew/science` – lolski Jan 27 '14 at 08:13
1
$ brew search opencv
        homebrew/science/opencv
$ brew install homebrew/science/opencv

after installed, there is Caveats:

==> Caveats If you need Python to find the installed site-packages:

mkdir -p ~/Library/Python/2.7/lib/python/site-packages

echo '/usr/local/lib/python2.7/site-packages' > ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth

so, just do

  mkdir -p ~/Library/Python/2.7/lib/python/site-packages
  echo '/usr/local/lib/python2.7/site-packages' > ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
andrewchan2022
  • 4,953
  • 45
  • 48