Ask Your Question
2

install opencv for anaconda ipython

asked 2013-07-25 08:41:40 -0500

mrgloom gravatar image

updated 2013-07-26 08:55:25 -0500

seems opencv is availible only for linux as pkg http://docs.continuum.io/anaconda/pkgs.html

how to install opencv for anaconda ipython?

I think OpenCV must be added to Python Package Index https://pypi.python.org/pypi

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
3

answered 2013-07-27 19:10:35 -0500

If you compile OpenCV from source, and Anaconda is your default python interpretor (CMake rule PYTHON_PACKAGES_PATH = C:\Anaconda\Lib\site-packages), then the install rule will copy cv2.pyd to C:\Anaconda\Lib\site-packages. Otherwise, you could do it manually, and make sure OpenCV libs are in the PATH.

edit flag offensive delete link more
1

answered 2014-11-19 13:45:31 -0500

pcp16 gravatar image

I've just gone through the whole process, therefore, I find the previously given answer a bit too vague (sorry, no offence).

You will need to compile OpenCV for yourself (not daunting, I hope). And you will need to change the variable that was pointed out before, but not just this variable (PYTHON_PACKAGES_PATH) but also all those referring to PYTHON paths (starting by PYTHON2_ or PYTHON3_), for instance:

PYTHON2_EXECUTABLE PYTHON2_INCLUDE_DIR PYTHON2_LIBRARY PYTHON2_NUMPY_INCLUDE_DIRS PYTHON2_PACKAGES_PATH

In all of them, you'll need to specify the path to the anaconda installation, not the system-installed Python interpreter (CMake, the tool used to compile OpenCV might automatically find either, or even a mixture!).

I would recommend you follow a step-by-step guide if you are not familiar with the compiling process. There are plenty, for Fedora 20, which is what I am using, you can find:

http://docs.opencv.org/trunk/doc/py_tutorials/py_setup/py_setup_in_fedora/py_setup_in_fedora.html

Even if you don't have Fedora, it might be useful to check all of the CMake variables they set, since this is made to reduce the compilation time, and avoid unnecessary modules that the Python module 'cv2' might not be able to use anyway).

After the compilation, I got an IMPORT_ERROR in Python when doing 'import cv2'. In my case, this was due to the dynamic libraries of opencv trying to reach the wrong version of 'libm.so'. So, please make sure you rename your "libm.so" under the Anaconda directory to something like 'libm.so.old', so that your libopencv*.so files can find the 'proper' one installed by the system. This shouldn't break Anaconda. See the following post for details:

https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/rX_c12a7Sps

I hope this helps!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

Stats

Asked: 2013-07-25 08:41:40 -0500

Seen: 17,805 times

Last updated: Nov 19 '14