openpose
openpose copied to clipboard
ImportError: cannot import name 'pyopenpose' from partially initialized module 'openpose' (most likely due to a circular import)
ImportError: cannot import name 'pyopenpose' from partially initialized module 'openpose' (most likely due to a circular import)
Did you ever get this figured out? I'm having the same issue on OS X.
Having the same issue.
Same issue here, ubuntu 18.04. OpenPose was working previously, now something in the environment must have changed, and it no longer imports the module.
Check /usr/local/python
and see if there's a pyopenpose file in there. If yes, it means pyopenpose was installed outside of your openpose build folder. I suppose you are trying to run an example. The example is looking for pyopenpose under path/to/openpose/python. You can fix this by using the command cp /usr/local/python path/to/openpose
cmake -DPYTHON_EXECUTABLE=~/anaconda3/bin/python3.8 -DPYTHON_LIBRARY=~/anaconda3/lib/libpython3.8.so.
this work for me
Hi, yes if you have a different version of python (not system python), then you may need to manually set those two parameters above. If you do sudo make install
, then openpose get's installed to /usr/local/python
and you simply need to add sys.path.append('/usr/local/python')
in your code to import openpose
same issue in windows 10. I built from source. Opened python and imported openpose and i got this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\openpose\build\python\openpose\__init__.py", line 1, in <module>
from . import pyopenpose as pyopenpose
ImportError: cannot import name 'pyopenpose' from partially initialized module 'openpose' (most likely due to a circular import) (C:\openpose\build\python\openpose\__init__.py)
On ubuntu 20.04.2 LTS, CPU only, built from source, I checked and make sure BUILD_PYHTON is flagged, openpose.bin works just fine.
If (from openpose dir) I run
ls build/python/
CMakeFiles/ cmake_install.cmake Makefile openpose/
ls build/python/openpose/
CMakeFiles cmake_install.cmake __init__.py __init__.pyc Makefile __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/
openpose pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/openpose/
CMakeFiles __init__.py __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
if just open the python3 console and run the following code:
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.append('/usr/local/python')
>>> from openpose import pyopenpose as op
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/python/openpose/__init__.py", line 1, in <module>
from . import pyopenpose as pyopenpose
ImportError: cannot import name 'pyopenpose' from partially initialized module 'openpose' (most likely due to a circular import) (/usr/local/python/openpose/__init__.py)
The same happens if I run sys.path.append('../../python')
instead of sys.path.append('/usr/local/python')
On ubuntu 20.04.2 LTS, CPU only, built from source, I checked and make sure BUILD_PYHTON is flagged, openpose.bin works just fine.
If (from openpose dir) I run
ls build/python/
CMakeFiles/ cmake_install.cmake Makefile openpose/
ls build/python/openpose/
CMakeFiles cmake_install.cmake __init__.py __init__.pyc Makefile __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/
openpose pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/openpose/
CMakeFiles __init__.py __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
if just open the python3 console and run the following code:
Python 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.append('/usr/local/python') >>> from openpose import pyopenpose as op Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python/openpose/__init__.py", line 1, in <module> from . import pyopenpose as pyopenpose ImportError: cannot import name 'pyopenpose' from partially initialized module 'openpose' (most likely due to a circular import) (/usr/local/python/openpose/__init__.py)
The same happens if I run
sys.path.append('../../python')
instead ofsys.path.append('/usr/local/python')
Solved it
Even if I don't have anaconda, by default the installer was creating the python file for python3.5 and not python3.8 .
I had to force it setting PYTHON_EXECUTABLE
to /usr/bin/python3
and PYTHON_LIBRARY
to /usr/lib/python3.8/config-3.8-x86_64-linux-gnu/lib/libpython3.8.so
in cmake-gui
I am on MacOS BigSur and having the same problem. Can someone please update this thread if there is a solution available for this circular dependency issue.
On ubuntu 20.04.2 LTS, CPU only, built from source, I checked and make sure BUILD_PYHTON is flagged, openpose.bin works just fine. If (from openpose dir) I run
ls build/python/
CMakeFiles/ cmake_install.cmake Makefile openpose/
ls build/python/openpose/
CMakeFiles cmake_install.cmake __init__.py __init__.pyc Makefile __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/
openpose pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/openpose/
CMakeFiles __init__.py __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
if just open the python3 console and run the following code:Python 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.append('/usr/local/python') >>> from openpose import pyopenpose as op Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python/openpose/__init__.py", line 1, in <module> from . import pyopenpose as pyopenpose ImportError: cannot import name 'pyopenpose' from partially initialized module 'openpose' (most likely due to a circular import) (/usr/local/python/openpose/__init__.py)
The same happens if I run
sys.path.append('../../python')
instead ofsys.path.append('/usr/local/python')
Solved it
Even if I don't have anaconda, by default the installer was creating the python file for python3.5 and not python3.8 . I had to force it setting
PYTHON_EXECUTABLE
to/usr/bin/python3
andPYTHON_LIBRARY
to/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/lib/libpython3.8.so
in cmake-gui
Worked after doing this, Thank you
On ubuntu 20.04.2 LTS, CPU only, built from source, I checked and make sure BUILD_PYHTON is flagged, openpose.bin works just fine.
If (from openpose dir) I run
ls build/python/
CMakeFiles/ cmake_install.cmake Makefile openpose/
ls build/python/openpose/
CMakeFiles cmake_install.cmake __init__.py __init__.pyc Makefile __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/
openpose pyopenpose.cpython-35m-x86_64-linux-gnu.so
ls /usr/local/python/openpose/
CMakeFiles __init__.py __pycache__ pyopenpose.cpython-35m-x86_64-linux-gnu.so
if just open the python3 console and run the following code:
Python 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path.append('/usr/local/python') >>> from openpose import pyopenpose as op Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/python/openpose/__init__.py", line 1, in <module> from . import pyopenpose as pyopenpose ImportError: cannot import name 'pyopenpose' from partially initialized module 'openpose' (most likely due to a circular import) (/usr/local/python/openpose/__init__.py)
The same happens if I run
sys.path.append('../../python')
instead ofsys.path.append('/usr/local/python')
I do not have pyopenpose.cpython-35m-x86_64-linux-gnu.so file in my system, How can I have it?
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.
In my case, there was no file named "pyopenpose.so" in "/usr/local/python". Try below commands.
cd /usr/local/python/openpose
sudo ln -s pyopenpose.cpython-36m-x86_64-linux-gnu.so pyopenpose.so
(in this case, you should use sys.path.append('/usr/local/python')
instead of sys.path.append('../../python')
)
Oh.. I didn’t even think about that solution. Thanks a lot for mail me.
2022년 8월 23일 (화) 오후 11:41, Kokilou @.***>님이 작성:
You are using conda environment, aren't you? I solved this question by using the environment when I cmake openpose.
— Reply to this email directly, view it on GitHub https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1623#issuecomment-1224173170, or unsubscribe https://github.com/notifications/unsubscribe-auth/AI3TL674DQIHI73WWRLJWYLV2TPIZANCNFSM4OGWAZ3Q . You are receiving this because you commented.Message ID: @.***>