Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unable to complete install of OpenCV. 'numpy/ndarrayobject.h' file not found

Hi all,

I am having an issue when trying to install OpenCV 3.0 using Python 3.5.1 on my Mac.

The error is below.

Please can someone help my out a little?

Thanks.

Ben

//Here is my terminal command script:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D PYTHON3_PACKAGES_PATH=~/.virtualenvs/cv3/lib/python3.5/site-packages \
    -D PYTHON3_LIBRARY=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5m.dylib \
    -D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/include/python3.5m \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D BUILD_EXAMPLES=ON \
    -D BUILD_opencv_python3=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules ..

//This is the error I get:

/Users/##/opencv/modules/python/src2/cv2.cpp:10:10: fatal error: 
      'numpy/ndarrayobject.h' file not found
#include <numpy/ndarrayobject.h>
         ^
[ 73%] Linking CXX executable ../../bin/cpp-example-dft
[ 73%] Built target example_dft
Scanning dependencies of target example_distrans
[ 73%] Building CXX object samples/cpp/CMakeFiles/example_distrans.dir/distrans.cpp.o
[ 73%] Linking CXX executable ../../bin/cpp-example-detect_mser
[ 73%] Built target example_detect_mser
Scanning dependencies of target example_drawing
[ 73%] Building CXX object samples/cpp/CMakeFiles/example_drawing.dir/drawing.cpp.o
1 error generated.
make[2]: *** [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 73%] Linking CXX executable ../../bin/cpp-example-distrans
[ 73%] Built target example_distrans
[ 73%] Linking CXX executable ../../bin/cpp-example-drawing
[ 73%] Built target example_drawing
[ 73%] Linking CXX shared library ../../lib/cv2.so
[ 73%] Built target opencv_python2
make: *** [all] Error 2