Could NOT find PythonLibs (missing: PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) for Python 3.5 support for OpenCV 3.1.0 on Windows

asked 2016-12-15 11:34:13 -0500

witcher gravatar image

updated 2016-12-17 07:37:16 -0500

berak gravatar image

I am trying to build the OpenCV from its sources and use its support for python. My predispositions:

  • downloaded latest opencv version 3.1.0
  • python 32bit version 3.5
  • numpy 32bit version 1.11.2
  • using CMake GUI for compilation
  • using Visual Studio Community 2015 for installation
  • using Visual Studio 2015 32bit compilator
  • following official tutorial: link text
  • Windows 10 64bit

After I run the build I can see that CMake cant find some source directories for building python3 module:

**Found PythonInterp: C:/Program Files (x86)/Python27/python2.exe (found suitable version "2.7.12", minimum required is "2.7") 
Found PythonLibs: C:/Program Files (x86)/Python27/libs/python27.lib (found suitable exact version "2.7.12") 
Found PythonInterp: C:/Program Files (x86)/Python35/python3.exe (found suitable version "3.5.1", minimum required is "3.4") 
Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is exact version "3.5.1")**

However the missing directories for Python3 are not missing for Python2. Python3 has equal folder structure on my computer as Python2.

**However, the python3 module is still unavailable among opencv modules:

OpenCV modules:
    To be built:                 core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d java stitching videostab python2
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python3 viz**

I can not find the reason why CMake is not able to find those paths. It finds right path for python3 executable, why not also include directory and python35.lib file?

Full CMake output:

The CXX compiler identification is MSVC 19.0.23506.0
The C compiler identification is MSVC 19.0.23506.0
Check for working CXX compiler using: Visual Studio 14 2015
Check for working CXX compiler using: Visual Studio 14 2015 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Check for working C compiler using: Visual Studio 14 2015
Check for working C compiler using: Visual Studio 14 2015 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Performing Test HAVE_CXX_FSIGNED_CHAR
Performing Test HAVE_CXX_FSIGNED_CHAR - Failed
Performing Test HAVE_C_FSIGNED_CHAR
Performing Test HAVE_C_FSIGNED_CHAR - Failed
FP16: Compiler support is available
Check if the system is big endian
Searching 16 bit integer
Looking for sys/types.h
Looking for sys/types.h - found
Looking for stdint.h
Looking for stdint.h - found
Looking for stddef.h
Looking for stddef.h - found
Check size of unsigned short
Check size of unsigned short - done
Using unsigned short
Check if the system is big endian - little endian
Looking for fseeko
Looking for fseeko - not found
Looking for unistd.h
Looking for unistd.h - not found
Check size of off64_t
Check size of off64_t - failed
Looking for assert.h
Looking for assert.h - found
Looking for fcntl.h
Looking for fcntl.h - found
Looking for io.h
Looking for io.h - found
Looking for jbg_newlen
Looking for jbg_newlen - not found
Looking for ...
(more)
edit retag flag offensive close merge delete

Comments

can you please replace your screenshots with a text version of your cmake output ? (long, but will contain useful hints !)

berak gravatar imageberak ( 2016-12-15 11:45:21 -0500 )edit

I know where are you heading. I found this in there:

OpenCV modules: To be built: core flann imgproc ml photo video imgcodecs shape videoio highgui objdetect superres ts features2d calib3d java stitching videostab Disabled: world Disabled by dependency: - Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev python2 python3 viz

Both python modules are unavailable for some reason. Do you still need whole output?

witcher gravatar imagewitcher ( 2016-12-15 12:02:36 -0500 )edit

the post is already edited with full output from CMake

witcher gravatar imagewitcher ( 2016-12-15 12:17:50 -0500 )edit

^^ apologies, then, missed it.

berak gravatar imageberak ( 2016-12-15 12:23:09 -0500 )edit

no problem, now would you be so kind and give me an advice here if it is possible? I am stuck on this issue more than week :(

witcher gravatar imagewitcher ( 2016-12-17 02:47:56 -0500 )edit

does your python3 have numpy ?

berak gravatar imageberak ( 2016-12-17 08:57:04 -0500 )edit

yes it does, I double-checked it

witcher gravatar imagewitcher ( 2016-12-17 09:16:58 -0500 )edit