CMU-Perceptual-Computing-Lab / openpose

OpenPose: Real-time multi-person keypoint detection library for body, face, hands, and foot estimation
https://cmu-perceptual-computing-lab.github.io/openpose
Other
31.21k stars 7.86k forks source link

'Did you enable `BUILD_PYTHON` in CMake?' #1635

Open mei-chen opened 4 years ago

mei-chen commented 4 years ago

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

dh10050160 commented 4 years ago

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

stale[bot] commented 4 years ago

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.

YoHo-O commented 4 years ago

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.
gembancud commented 4 years ago

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

YoHo-O commented 4 years ago

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

fweidner commented 3 years ago

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

gineshidalgo99 commented 3 years ago

@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!

fweidner commented 3 years ago

@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.

HYC986 commented 3 years ago

@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!

thomai-d commented 3 years ago

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

But it didn't work for me.

jacob0811 commented 3 years ago

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

KeonAcute commented 3 years ago

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

fweidner commented 3 years ago

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)

jacob0811 commented 3 years ago

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

fweidner commented 3 years ago

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

sbarkaren commented 3 years ago

"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

stale[bot] commented 2 years ago

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.

hmkamrans commented 12 months ago

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

waadyy commented 9 months ago

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?

vincenzomarotta commented 5 months ago

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?

Hi, did you manage to find a solution to this?

kaneviggers commented 2 months ago

Still having the same issue, I've tried everything I could think of to no avail