简体   繁体   中英

Requested modules not available: vtkRenderingOpenGL-cmake/OpenCVDetectVTK.cmake:6 (find_package)

I am basically trying to install OpenCV3 with Python3.5. I have successfully gone through all the steps in this tutorial for git checkout 3.1.0 of opencv. However when I enter this command:

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.2_1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib \
    -D PYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.5.2_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 ..

I get this error:

...etc...
-- Checking for module 'gstreamer-base-1.0'
--   No package 'gstreamer-base-1.0' found
-- Checking for module 'gstreamer-video-1.0'
--   No package 'gstreamer-video-1.0' found
-- Checking for module 'gstreamer-app-1.0'
--   No package 'gstreamer-app-1.0' found
-- Checking for module 'gstreamer-riff-1.0'
--   No package 'gstreamer-riff-1.0' found
-- Checking for module 'gstreamer-pbutils-1.0'
--   No package 'gstreamer-pbutils-1.0' found
-- Checking for module 'gstreamer-base-0.10'
--   No package 'gstreamer-base-0.10' found
-- Checking for module 'gstreamer-video-0.10'
--   No package 'gstreamer-video-0.10' found
-- Checking for module 'gstreamer-app-0.10'
--   No package 'gstreamer-app-0.10' found
-- Checking for module 'gstreamer-riff-0.10'
--   No package 'gstreamer-riff-0.10' found
-- Checking for module 'gstreamer-pbutils-0.10'
--   No package 'gstreamer-pbutils-0.10' found
-- Checking for module 'libdc1394-2'
--   No package 'libdc1394-2' found
-- Checking for module 'libdc1394'
--   No package 'libdc1394' found
-- Checking for module 'libv4l1'
--   No package 'libv4l1' found
-- Checking for module 'libv4l2'
--   No package 'libv4l2' found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - not found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Checking for module 'libavcodec'
--   Found libavcodec, version 57.48.101
-- Checking for module 'libavformat'
--   Found libavformat, version 57.41.100
-- Checking for module 'libavutil'
--   Found libavutil, version 55.28.100
-- Checking for module 'libswscale'
--   Found libswscale, version 4.1.100
-- Checking for module 'libavresample'
--   Found libavresample, version 3.0.0
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
-- Checking for module 'libgphoto2'
--   No package 'libgphoto2' found
-- ICV: Removing previous unpacked package: /Users/mona/computer_vision/Face_Recognition/opencv/3rdparty/ippicv/unpack
-- ICV: Unpacking ippicv_macosx_20151201.tgz to /Users/mona/computer_vision/Face_Recognition/opencv/3rdparty/ippicv/unpack...
-- ICV: Package successfully downloaded
-- found IPP (ICV version): 9.0.1 [9.0.1]
-- at: /Users/mona/computer_vision/Face_Recognition/opencv/3rdparty/ippicv/unpack/ippicv_osx
-- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.11")
-- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR=<filepath> option to cmake
-- Found PythonInterp: /usr/local/bin/python2.7 (found suitable version "2.7.12", minimum required is "2.7")
-- Could NOT find PythonLibs: Found unsuitable version "2.7.10", but required is exact version "2.7.12" (found /usr/lib/libpython2.7.dylib)
-- Found PythonInterp: /usr/local/bin/python3.4 (found suitable version "3.4.1", minimum required is "3.4")
-- Could NOT find PythonLibs: Found unsuitable version "3.5.2", but required is exact version "3.4.1" (found /usr/local/Cellar/python3/3.5.2_1/Frameworks/Python.framework/Versions/3.5/lib/libpython3.5.dylib)
-- Found apache ant 1.9.7: /usr/local/bin/ant
-- Found JNI: /System/Library/Frameworks/JavaVM.framework
-- Could NOT find Matlab (missing:  MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN)
CMake Error at /usr/local/Cellar/vtk/7.0.0_1/lib/cmake/vtk-7.0/vtkModuleAPI.cmake:120 (message):
  Requested modules not available:

    vtkRenderingOpenGL
Call Stack (most recent call first):
  /usr/local/lib/cmake/vtk-7.0/VTKConfig.cmake:88 (vtk_module_config)
  cmake/OpenCVDetectVTK.cmake:6 (find_package)
  CMakeLists.txt:597 (include)

I have tried it with both ON and OFF for -D INSTALL_C_EXAMPLES=ON \\ line still no success. Any feedback is really appreciated!

This is the log for flag set to OFF: http://pastebin.com/NF1bbpBC

It took me a good few hours to get this fixed. Here's what I did:

wget https://github.com/Itseez/opencv/archive/3.1.0.zip
wget https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
unzip 3.1.0.zip
unzip 3.1.0.zip.1
cd opencv-3.1.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D BUILD_opencv_java=OFF \
      -D WITH_IPP=OFF -D WITH_1394=OFF \
      -D WITH_FFMPEG=OFF \
      -D BUILD_EXAMPLES=OFF \
      -D BUILD_TESTS=OFF \
      -D BUILD_PERF_TESTS=OFF \
      -D BUILD_DOCS=OFF \
      -D BUILD_opencv_python2=ON \
      -D BUILD_opencv_python3=ON \
      -D BUILD_opencv_video=OFF \
      -D BUILD_opencv_videoio=OFF \
      -D BUILD_opencv_videostab=OFF \
      -D PYTHON_EXECUTABLE=$(which python) \
      -D OPENCV_EXTRA_MODULES_PATH=/Users/mona/computer_vision/Face_Recognition/opencv_contrib-3.1.0/modules ..

In the last one make sure to have the absolute path not something like -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/opencv_contrib-3.1.0/modules ..

Also you would need vi cmake/OpenCVDetectVTK.cmake and change line 6 so it has vtkRenderingOpenGL2 instead of vtkRenderingOpenGL :

6 find_package(VTK QUIET COMPONENTS vtkRenderingOpenGL2 vtkInteractionStyle vtkRenderingLOD vtkIOPLY vtkFiltersTexture vtkRenderingFreeType vtkIOExport NO_MODULE)

Verify if you are using VTK7. If yes, then replace vtkRenderingOpenGL by vtkRenderingOpenGL2 in in line 6 of the file /cmake/OpenCVDetectVTK.cmake

The answer was posted here: https://github.com/opencv/opencv/issues/6180#issuecomment-204500571

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM