Opencv_contrib: OpenCV 3.1.0 build issue with python headers

Created on 5 Sep 2017  Â·  11Comments  Â·  Source: opencv/opencv_contrib

Hey everyone,
I'm trying to install OpenCV 3.1.0 on my Ubuntu 16.04 with Cuda-8.0 support.
I got my opencv files from this link: https://gist.github.com/filitchp/5645d5eebfefe374218fa2cbf89189aa
and followed the steps.
Make goes fine untill the 100% where it faces some errors and quits...
I couldn't find a way to fix this error and didn't find any similar issue so decided to post the matter here
here is my errors:

[ 98%] Built target opencv_superres
[100%] Built target opencv_videostab
[100%] Generating pyopencv_generated_include.h, pyopencv_generated_funcs.h, pyopencv_generated_types.h, pyopencv_generated_type_reg.h, pyopencv_generated_ns_reg.h
[100%] 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/alireza/opencv-3.1.0-with-cuda8/modules/python/python2/..//src2/gen2.py", line 943, in <module>
generator.gen(srcfiles, dstdir)
File "/home/alireza/opencv-3.1.0-with-cuda8/modules/python/python2/..//src2/gen2.py", line 852, in gen
decls = self.parser.parse(hdr)
File "/home/alireza/opencv-3.1.0-with-cuda8/modules/python/src2/hdr_parser.py", line 746, in parse
f = io.open(hname, 'rt', encoding='utf-8')
IOError: [Errno 2] No such file or directory: ''
modules/python2/CMakeFiles/opencv_python2.dir/build.make:63: recipe for target 'modules/python2/pyopencv_generated_include.h' failed
make[2]: *** [modules/python2/pyopencv_generated_include.h] Error 1
CMakeFiles/Makefile2:5937: recipe for target 'modules/python2/CMakeFiles/opencv_python2.dir/all' failed
make[1]: *** [modules/python2/CMakeFiles/opencv_python2.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "/home/alireza/opencv-3.1.0-with-cuda8/modules/python/python3/..//src2/gen2.py", line 943, in <module>
generator.gen(srcfiles, dstdir)
File "/home/alireza/opencv-3.1.0-with-cuda8/modules/python/python3/..//src2/gen2.py", line 852, in gen
decls = self.parser.parse(hdr)
File "/home/alireza/opencv-3.1.0-with-cuda8/modules/python/src2/hdr_parser.py", line 746, in parse
f = io.open(hname, 'rt', encoding='utf-8')
FileNotFoundError: [Errno 2] No such file or directory: ''
modules/python3/CMakeFiles/opencv_python3.dir/build.make:63: recipe for target 'modules/python3/pyopencv_generated_include.h' failed
make[2]: *** [modules/python3/pyopencv_generated_include.h] Error 1
CMakeFiles/Makefile2:6017: recipe for target 'modules/python3/CMakeFiles/opencv_python3.dir/all' failed
make[1]: *** [modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

and modules/python2/headers.txt:
headers.txt

builinstall incomplete

Most helpful comment


This comment is not related to the original problem (alalek)

Try to run "make gen_opencv_python_source" and then "make all".
Try to start again from scratch (clean build directory).

Build / usage questions should go to Users OpenCV Q/A forum: http://answers.opencv.org

All 11 comments

Please attach to issue headers.txt file from <build_dir>/modules/python2

OpenCV 3.1.0 on my Ubuntu 16.04 with Cuda-8.0

This configuration is not supported. OpenCV 3.1 is released before releases of Ubuntu 16.04 and CUDA 8.0 so OpenCV 3.1 can't support them well. Try latest release OpenCV 3.3.0 or use "master" branch.

@alalek Tnx alot, I'll try OpenCV 3.3.0 and I hope I won't post another issues :)
Btw I don't know how to attach this issue to the file you mentioned ... Ik it's lame but I'm kinda new at posting on github

Just drag and drop into new comment's textbox: https://help.github.com/articles/file-attachments-on-issues-and-pull-requests/

BTW,
Usage/support questions should go to Users OpenCV Q/A forum: http://answers.opencv.org
This is a place for issues that needs fix - return back if you have confirmed bug.

@alalek K, attached the headers.txt file you mentioned and I will go to answers.opencv from now on. I will post a new issue there if I face an issue again, tnx


This comment is not related to the original problem (alalek)

Hello everyone,
I'm trying to install OpenCV 3.4.1 on my Ubuntu 16.04 lts
When i try to build it show me an error(i'm new on ubuntu cause i follow an excellent tutorial https://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/#comment-451886)
that error:

[ 85%] Building CXX object modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o
/home/abba/opencv-3.4.1/modules/python/src2/cv2.cpp:22:40: fatal error: pyopencv_generated_include.h: No file or folder of this type
compilation terminated.
modules/python3/CMakeFiles/opencv_python3.dir/build.make:62 : the recipe for the target « modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o » failed
make[2]: * [modules/python3/CMakeFiles/opencv_python3.dir/__/src2/cv2.cpp.o] Error 1
CMakeFiles/Makefile2:23545 : the recipe for the target« modules/python3/CMakeFiles/opencv_python3.dir/all » failed
make[1]:
[modules/python3/CMakeFiles/opencv_python3.dir/all] Error 2
Makefile:160 : the recipe for the target « all » failed
make: *
* [all] Error 2


This comment is not related to the original problem (alalek)

Try to run "make gen_opencv_python_source" and then "make all".
Try to start again from scratch (clean build directory).

Build / usage questions should go to Users OpenCV Q/A forum: http://answers.opencv.org


This comment is not related to the original problem (alalek)

thank you very much it fixed @alalek


This comment is not related to the original problem (alalek)

I met this problem that I installed virtual environment with Python3 only that the headers generation relies on python2.7 only, :( It took me several days to finally figure this out.

I then switch out to non virtual env to manually generated headers using python2.7:

python ./modules/python/src2/gen2.py ./build/modules/python_bindings_generator ./build/modules/python_bindings_generator/headers.txt

Then coming back to virtual env with python3 only, to continue installation opencv3.4.1, it works. :)


This comment is not related to the original problem (alalek)

@jinchenglee Ran into the same issue Looked into the script you referenced and saw that it had conditional imports for python3 vs. python2. Ran the same command from inside the virtual env (with python3.5) and was able to finish the build. Looks like the step might be being missed in the process...

Last comments are not related to the original problem, so I'm locking this issue.

Was this page helpful?
0 / 5 - 0 ratings