openpose icon indicating copy to clipboard operation
openpose copied to clipboard

'Did you enable `BUILD_PYTHON` in CMake?'

Open mei-chen opened this issue 4 years ago • 20 comments

Issue Summary

Screen Shot 2020-07-05 at 4 25 30 PM

Executed Command (if any)

python 02_whole_body_from_image.py

Errors

'Error: OpenPose library could not be found. Did you enable `BUILD_PYTHON` in CMake and have this Python script in the right folder?
cannot import name 'pyopenpose' from 'openpose' (../../python/openpose/__init__.py)'

Type of Issue

  • Compilation/installation error

mei-chen avatar Jul 05 '20 20:07 mei-chen

我也是遇到同樣問題,不過已經解決了 而我是參考其他人的方法,你可以到這裡看看 https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1027#issuecomment-656527634

dh10050160 avatar Jul 10 '20 07:07 dh10050160

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 11 '20 03:09 stale[bot]

In this case, you should use the python which you compile in 'cmake ..' step. For me, when I use python3.6 to compile, then I get the lib file: pyopenpose.cpython-36m-x86_64-linux-gnu.so, and then I can only run this example in python3.6(if using python3.7, the error shows: can't import pyopenpose from openpose), but when I try using python3.7 to compile, I get lib file: pyopenpose.cpython-37m-x86_64-linux-gnu.so , which I can only run in python3.7(if using python3.6, the error shows likewise). There are some tips should be remembered:

  1. If you are using remote server to run this code, please change 'default path' in the examples to 'absolute path', or you may not find the openpose(unknown location).
  2. If you want to using your own python version, please add variables in the 'cmake ..' step (for terminial use): for instance: "cmake -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/YourPythonBinPath/bin/pythonX.X -DPYTHON_LIBRARY=/YourPythonLibPath/libpythonX.Xm.so.1.0 .." You may need to run it twice untill no warning shows.
  3. If 2. run successfully, but you get python error in " make -j'nproc' " step, please check if you have libpythonX.X modules in your dpkg(use command: dpkg -l libpythonX.X*), if not, install it by: sudo apt install libpython3.7-dev. help this can help you.

YoHo-O avatar Sep 19 '20 06:09 YoHo-O

In this case, you should use the python which you compile in 'cmake ..' step. For me, when I use python3.6 to compile, then I get the lib file: pyopenpose.cpython-36m-x86_64-linux-gnu.so, and then I can only run this example in python3.6(if using python3.7, the error shows: can't import pyopenpose from openpose), but when I try using python3.7 to compile, I get lib file: pyopenpose.cpython-37m-x86_64-linux-gnu.so , which I can only run in python3.7(if using python3.6, the error shows likewise). There are some tips should be remembered:

  1. If you are using remote server to run this code, please change 'default path' in the examples to 'absolute path', or you may not find the openpose(unknown location).
  2. If you want to using your own python version, please add variables in the 'cmake ..' step (for terminial use): for instance: "cmake -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/YourPythonBinPath/bin/pythonX.X -DPYTHON_LIBRARY=/YourPythonLibPath/libpythonX.Xm.so.1.0 .." You may need to run it twice untill no warning shows.
  3. If 2. run successfully, but you get python error in " make -j'nproc' " step, please check if you have libpythonX.X modules in your dpkg(use command: dpkg -l libpythonX.X*), if not, install it by: sudo apt install libpython3.7-dev. help this can help you.

What version do you have for cuda and cudnn? I'm struggling to build everything on wsl, cuda 11, cudnn8

gembancud avatar Sep 19 '20 15:09 gembancud

In this case, you should use the python which you compile in 'cmake ..' step. For me, when I use python3.6 to compile, then I get the lib file: pyopenpose.cpython-36m-x86_64-linux-gnu.so, and then I can only run this example in python3.6(if using python3.7, the error shows: can't import pyopenpose from openpose), but when I try using python3.7 to compile, I get lib file: pyopenpose.cpython-37m-x86_64-linux-gnu.so , which I can only run in python3.7(if using python3.6, the error shows likewise). There are some tips should be remembered:

  1. If you are using remote server to run this code, please change 'default path' in the examples to 'absolute path', or you may not find the openpose(unknown location).
  2. If you want to using your own python version, please add variables in the 'cmake ..' step (for terminial use): for instance: "cmake -DBUILD_PYTHON=ON -DPYTHON_EXECUTABLE=/YourPythonBinPath/bin/pythonX.X -DPYTHON_LIBRARY=/YourPythonLibPath/libpythonX.Xm.so.1.0 .." You may need to run it twice untill no warning shows.
  3. If 2. run successfully, but you get python error in " make -j'nproc' " step, please check if you have libpythonX.X modules in your dpkg(use command: dpkg -l libpythonX.X*), if not, install it by: sudo apt install libpython3.7-dev. help this can help you.

What version do you have for cuda and cudnn? I'm struggling to build everything on wsl, cuda 11, cudnn8

CUDA-10.1 ; cudnn-7.5

YoHo-O avatar Sep 20 '20 01:09 YoHo-O

Just for the record and for future devs (as I do not know if it is still valid): It seems to me that this error message does not necessarily indicate that the python libs are missing. It could be that other dlls required by openpose are missing.

For me, the issue was solved by downloading the release version and copying some dlls from the release to my Build/x64/Release folder. I guess that's not supposed to be necessary though.

image

fweidner avatar Nov 19 '20 20:11 fweidner

@fweidner Just to make sure to add it in the doc, which DLLs did you have to copy? (other than the ones in the build/bin folder as explained in the doc) Thanks!

gineshidalgo99 avatar Nov 22 '20 19:11 gineshidalgo99

@gineshidalgo99 I needed to copy these dlls. If I remove one of them, I get the error mentioned above. It seems kind of wrong (especially the opencv dll) but it works 🤷🏻 To get this list, I copied all dlls (except openpose.dll) to the Release folder and removed them one by one.

  • avcodec-57.dll
  • avformat-57.dll
  • avutil-55.dll
  • freeglut.dll
  • GCBase_MD_VC140_v3_0.dll
  • GenApi_MD_VC140_v3_0.dll
  • GenTL_v140.dll
  • gflags.dll
  • libiomp5md.dll
  • Log_MD_VC140_v3_0.dll
  • log4net.dll
  • MathParser_MD_VC140_v3_0.dll
  • NodeMapData_MD_VC140_v3_0.dll
  • opencv_world420.dll
  • PGRHostControl_dll.dll
  • postproc-54.dll
  • PtGreyVideoEncoder_v140.dll
  • Spinnaker_v140.dll
  • swresample-2.dll
  • swscale-4.dll
  • XMLParser_MD_VC140_v3_0.dll
  • XMLParser_MDd_VC140_v3_0.dll

fweidner avatar Nov 23 '20 10:11 fweidner

@gineshidalgo99 I needed to copy these dlls. If I remove one of them, I get the error mentioned above. It seems kind of wrong (especially the opencv dll) but it works 🤷🏻 To get this list, I copied all dlls (except openpose.dll) to the Release folder and removed them one by one.

  • avcodec-57.dll
  • avformat-57.dll
  • avutil-55.dll
  • freeglut.dll
  • GCBase_MD_VC140_v3_0.dll
  • GenApi_MD_VC140_v3_0.dll
  • GenTL_v140.dll
  • gflags.dll
  • libiomp5md.dll
  • Log_MD_VC140_v3_0.dll
  • log4net.dll
  • MathParser_MD_VC140_v3_0.dll
  • NodeMapData_MD_VC140_v3_0.dll
  • opencv_world420.dll
  • PGRHostControl_dll.dll
  • postproc-54.dll
  • PtGreyVideoEncoder_v140.dll
  • Spinnaker_v140.dll
  • swresample-2.dll
  • swscale-4.dll
  • XMLParser_MD_VC140_v3_0.dll
  • XMLParser_MDd_VC140_v3_0.dll

where and how can I get those DLL? Thanks!

HYC986 avatar Mar 16 '21 10:03 HYC986

From here: https://github.com/CMU-Perceptual-Computing-Lab/openpose/releases

But it didn't work for me.

thomai-d avatar Mar 19 '21 11:03 thomai-d

Has anyone found a solution for this please, it is really frustrating. I am checking the BUILD_PYTHON in CMAKE for sure..

jacob0811 avatar Apr 05 '21 21:04 jacob0811

So sad,I had take it,but nothing can be solved.

KeonAcute avatar Apr 06 '21 08:04 KeonAcute

Hi, just coming back to this.

Feel free to also copy the other DLLs from the official release (except your build openpose of course). For me, I first copied all DLLs, then build openpose, and then deleted the copied DLLs one by one to see which one lead to the specific error. This resulted in the above-mentioned list.

For you folks, it might be that you need more or different DLLs (but I can't guarantee that it works - maybe the issue is somewhere else)

fweidner avatar Apr 06 '21 08:04 fweidner

Hi @fweidner, thank you very much for your message

  1. I did copy all dll files and is asking me for a dll file named opencv_world450.dll which is not in the latest release where I got the dll files, is this because of the opencv version or not?

  2. And do I maybe need to change something from the highlighted lines of code maybe to solve this problem?

image

jacob0811 avatar Apr 06 '21 09:04 jacob0811

Hi, I'm not sure anymore :) The missing opencv is probably one issue and might lead to the python error..

fweidner avatar Apr 07 '21 08:04 fweidner

"If you are using remote server to run this code, please change 'default path' in the examples to 'absolute path', or you may not find the openpose(unknown location)." where exactly? we are installing on google colab but is not working for us. please help me

sbarkaren avatar May 06 '21 16:05 sbarkaren

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 09 '22 07:01 stale[bot]

I am facing the same issue, I have placed the files as mentioned above, but still I am getting no module named pyopenpose,

hmkamrans avatar Nov 14 '23 05:11 hmkamrans

I am facing the same issue, I have placed the files as mentioned above, but still I am getting no module named pyopenpose,

Hi, I am experiencing the same error. Do you know its cause and how to fix it?

waadyy avatar Feb 07 '24 13:02 waadyy