In file included from /home/sclab/Downloads/openpose/3rdparty/pybind11/include/pybind11/pytypes.h:12:0,
from /home/sclab/Downloads/openpose/3rdparty/pybind11/include/pybind11/cast.h:13,
from /home/sclab/Downloads/openpose/3rdparty/pybind11/include/pybind11/attr.h:13,
from /home/sclab/Downloads/openpose/3rdparty/pybind11/include/pybind11/pybind11.h:44,
from /home/sclab/Downloads/openpose/python/openpose/openpose_python.cpp:9:
/home/sclab/Downloads/openpose/3rdparty/pybind11/include/pybind11/detail/common.h:112:20: fatal error: Python.h: No such file or directory
compilation terminated.
python/openpose/CMakeFiles/pyopenpose.dir/build.make:62: recipe for target 'python/openpose/CMakeFiles/pyopenpose.dir/openpose_python.cpp.o' failed
make[2]: * [python/openpose/CMakeFiles/pyopenpose.dir/openpose_python.cpp.o] Error 1
CMakeFiles/Makefile2:2200: recipe for target 'python/openpose/CMakeFiles/pyopenpose.dir/all' failed
make[1]: [python/openpose/CMakeFiles/pyopenpose.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: ** [all] Error 2
How to solve it, please i am new
Odd..i assumed Ubuntu as python-dev by default
Can you try these solutions:
https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory
That actually happened to me because I was using the wrong Python version (I had both 3.5 and 3.6).
You need to install sudo apt-get install python3.5-dev for your Python version (this example is for 3.5, just check which version you are trying to build against).
Please, let me know if this works
Odd..i assumed Ubuntu as python-dev by default
Can you try these solutions:
https://stackoverflow.com/questions/21530577/fatal-error-python-h-no-such-file-or-directory
i already try this
sudo apt-get install python-dev
sudo apt-get install python3-dev
sudo apt-get install python3.5-dev
all no update
and delete build folder and build new one, still same error
That actually happened to me because I was using the wrong Python version (I had both 3.5 and 3.6).
You need to install
sudo apt-get install python3.5-devfor your Python version (this example is for 3.5, just check which version you are trying to build against).Please, let me know if this works
not working, still same error
Then i can't answer unless you provide your whole config as the issue template indicated (closed temporarily until the config is added)
sorry, i give up debugging and try reinstall my ubuntu OS, then install all from beginning
That should definitively work, as long as you run sudo apt-get install python-dev python3-dev (I would add this to the doc soon)
I can confirm the same problem with Ubuntu 16.04. When I locate the Python.h with:
locate Python.h
I receive:
/usr/include/python2.7/Python.h
/usr/include/python3.5m/Python.h
So, the system contains the necessary header files. I am working on this. If I can figure out what the problem is, I will add it to this thread.
Update 1: Reinstalling the dependencies _did not_ solve the problem.
you can manually add python flags in cmake-gui, if you enable "Advance" mode:
search for CMAKE_CXX_FLAGS and add " -I/usr/include/python2.7 -lpython2.7 "
you can manually add python flags in cmake-gui, if you enable "Advance" mode:
search for CMAKE_CXX_FLAGS and add " -I/usr/include/python2.7 -lpython2.7 "
I can confirm this solution works.
you can manually add python flags in cmake-gui, if you enable "Advance" mode:
search for CMAKE_CXX_FLAGS and add " -I/usr/include/python2.7 -lpython2.7 "
i am newer,i do not where CMAKE_CXX_FLAGS is,can you help me?
Go to your build directory
cd openpose/build
cmake ..
Note it’s .. and not a . If you get an error, I think it will prompt you to install something like curses.
This should activate the cmake parameters menu, look at the bottom screen for advanced ( I think it’s t ), it will flesh out more parameters. Move the cursor to the line for the parameter to change, press Enter to change to whatever you want. Then press c to configure and g to generate. You can then do a make -j4 ( or how ever number of cpu you have )
i got the same problem when using python3.6, it's not work with "sudo apt-get install python-dev python3-dev"; but it works after remove python3.6,
you can manually add python flags in cmake-gui, if you enable "Advance" mode:
search for CMAKE_CXX_FLAGS and add " -I/usr/include/python2.7 -lpython2.7 "
Can you please give an example what exactly to modify in the file and how?
I am using Ubuntu 18.04
None of the solutions worked for me except this one:
you can manually add python flags in cmake-gui, if you enable "Advance" mode:
search for CMAKE_CXX_FLAGS and add " -I/usr/include/python2.7 -lpython2.7 "
I have worked with openpose previously on the same OS but this error popped up for the first time now. Not able to understand what changed.
Most helpful comment
That actually happened to me because I was using the wrong Python version (I had both 3.5 and 3.6).
You need to install
sudo apt-get install python3.5-devfor your Python version (this example is for 3.5, just check which version you are trying to build against).Please, let me know if this works