Ask Your Question

opencv make

asked 2016-02-04 00:48:23 -0500

tbright gravatar image

updated 2016-02-04 06:12:00 -0500

Hi All,

I face an error when install opencv.

The error is:  Generating pyopencv_generated_include.h, pyopencv_generated_funcs.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_ns_reg.h
Traceback (most recent call last):
  File "/home/cudauser/tianye/opencv/modules/python/python2/..//src2/", line 943, in <module>
    generator.gen(srcfiles, dstdir)
  File "/home/cudauser/tianye/opencv/modules/python/python2/..//src2/", line 852, in gen
    decls = self.parser.parse(hdr)
  File "/home/cudauser/tianye/opencv/modules/python/src2/", line 746, in parse
    f =, 'rt', encoding='utf-8')
IOError: [Errno 2] No such file or directory: ''
make[2]: *** [modules/python2/pyopencv_generated_include.h] Error 1
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make: *** [all] Error 2

Can anybody help me? Thanks in advance.

edit retag flag offensive close merge delete


Are you in need of python support? If not, the easiest solution for you is disabling the build of python wrappers in CMAKE-GUI.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-02-04 06:12:51 -0500 )edit

i looked it up, it's the part, where is fed the opencv module headers for parsing, and one of them (or all ?) seems to be missing.

weird error ;(

berak gravatar imageberak ( 2016-02-04 06:16:56 -0500 )edit

yes i need python support T-T

tbright gravatar imagetbright ( 2016-02-04 20:46:42 -0500 )edit

I get the same error. I tried modifying the gen2 code to skip blank entries, in the off chance that maybe it was an accidental blank entry in an otherwise usable list, but then I got a long string of errors of the form:

/../opencv/modules/python/src2/cv2.cpp:115:9: error: ‘SimpleBlobDetector’ does not name a type
 typedef SimpleBlobDetector::Params SimpleBlobDetector_Params;
/.../opencv/modules/python/src2/cv2.cpp:119:9: error: ‘cvflann’ does not name a type
 typedef cvflann::flann_distance_t cvflann_flann_distance_t;
hosford42 gravatar imagehosford42 ( 2016-11-27 21:35:00 -0500 )edit

@berak, yes, they are all missing. The headers list contains only one item, the empty string.

hosford42 gravatar imagehosford42 ( 2016-11-27 22:46:11 -0500 )edit

Has anybody found a solution to this using release 3.1.0?

CoderCole gravatar imageCoderCole ( 2017-02-01 11:34:54 -0500 )edit

2 answers

Sort by » oldest newest most voted

answered 2016-12-08 19:52:58 -0500

kramimus gravatar image

I had the same issue/same error with release 3.1.0 when building with python bindings. This might not be an option for you, but everything works for me when building from master (commit beea04cc892d826eeb9176234045a1318e3ad408).

edit flag offensive delete link more


Hi, would you please explain how to build from master?? Thanks a lot@kramimus

qinchuyu gravatar imageqinchuyu ( 2017-03-02 20:58:15 -0500 )edit

answered 2017-08-04 08:40:10 -0500

jon.crall gravatar image

updated 2017-08-04 09:50:56 -0500

I found the reason for this problem. The file modules/python/src2/common.cmake is the file that generates the headers.txt that is passed into This file will filter out any file that matches any of the following regexes:

ocv_list_filterout(opencv_hdrs ".h$")
ocv_list_filterout(opencv_hdrs "cuda")
ocv_list_filterout(opencv_hdrs "cudev")
ocv_list_filterout(opencv_hdrs "/hal/")
ocv_list_filterout(opencv_hdrs "detection_based_tracker.hpp") # Conditional compilation

My build directory happend to be called py2-nocuda, so everything got filtered out, which caused this error. I assume something similar happened to you. You can probably rename your build dir (or change the path so it doesn't match any of these regexes) and then it will work.

I'm currently working on a patch to make these regexes a bit more specific. In the meanwhile I hope nobody has a homefolder named "cuda-user" :).

EDIT: it looks like this issue was fixed on 2016-07-13 by Maksim Shabunin in commit f698bc1cc277e8e7bc28c307438a5300268b5a25 It should be in versions 3.2.0 and beyond.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools



Asked: 2016-02-04 00:48:23 -0500

Seen: 968 times

Last updated: Aug 04 '17