Ask Your Question
1

Installing OpenCV with Anaconda on OS X

asked 2014-02-13 12:22:34 -0600

link gravatar image

Hello,

I have tried to install OpenCV multiple times over the past couple of days, via both homebrew and from source. I have tried following recipes such as the following, all to no avail.

No matter what I seem to do, I seem to segfault (segmentation fault 11) whenever I try to import OpenCV in python.

I have:

  • OS X 10.9.1
  • conda 3.0.3
  • Python 2.7.6 :: Anaconda 1.9.0 (x86_64)
  • the command line tools for OS X, including gcc, etc.
  • cmake (might be the homebrew version) -- unclear if that matters

I would appreciate any suggestions or recommendations as to how to determine where the error is (as a segmentation fault is not a very instructive error), and then how to go about correcting it.

edit retag flag offensive close merge delete

Comments

Also having trouble with this. Anyone with a recent solution? (On Mac OS 10.9, Anaconda 1.9, Python 2.7.6)

tabchas gravatar imagetabchas ( 2014-03-09 20:45:01 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-05-07 23:33:35 -0600

krader gravatar image

There is a pre-built conda package available via

conda install -c https://conda.binstar.org/jjhelmus opencv

It does want to downgrade numpy to version 1.7.1 from the current (as I type this) version 1.8.2 so I first cloned my ipython2 environment:

conda create -n opencv --clone ip2

Then I activated the opencv environment before doing the install above. There is also a conda install recipe at https://github.com/conda/conda-recipes/tree/master/opencv which looks reasonable and would probably allow someone to build opencv against the most current numpy version but I didn't try using it. There is also a discussion thread at https://gist.github.com/welch/6468594 with instructions that look like they should work but, again, I didn't try them in preference to the simple "conda install" above.

edit flag offensive delete link more

Comments

How do I activate the opencv environment? ... When I entered conda create -n opencv --clone ip2 I received Error: could not find environment: ip2

What do i need to do? Thanks!

bonniet gravatar imagebonniet ( 2015-05-24 14:31:08 -0600 )edit

The --clone option is cloning an existing environment called ip2. You probably don't have one called ip2. To make a new environment called opencv which is initially a clone of your base environment try conda create -n opencv --clone ~anaconda. To access it: source activate opencv. To go back to your base environment: source deactivate. Everything you do (e.g. install) while in the opencv environment will not affect the base environment.

Here are the docs for conda (specifically the faq for environments): http://conda.pydata.org/docs/faq.html... ...and here's a nice cheat sheet: https://gist.github.com/qheuristics/8...

kungfujam gravatar imagekungfujam ( 2015-07-28 10:30:20 -0600 )edit

Question Tools

Stats

Asked: 2014-02-13 12:22:34 -0600

Seen: 7,504 times

Last updated: May 07 '14