ros-visualization / rviz

ROS 3D Robot Visualizer
BSD 3-Clause "New" or "Revised" License
847 stars 463 forks source link

cannot import name 'librviz_sip'/librviz_shiboken from partially initialized module 'rviz' (most likely due to a circular import) #1822

Closed programmeddeath1 closed 6 months ago

programmeddeath1 commented 6 months ago

I have built ros1 on ubuntu 22.04 from source following these steps - https://gist.github.com/Meltwin/fe2c15a5d7e6a8795911907f627255e0 with rosdep and vcstool installed through your guide in https://ros.packages.techfak.net/. I couldn't use the deb files as my system was arm64 based.

Rviz loads properly through rosrun rviz rviz. But when I try to import rviz from my pyqt application it fails with the following error -

Traceback (most recent call last):
  File "/home/greenpi/app/delta_app_master/main_delta_app/src/delta_gui/main.py", line 59, in <module>
    import rviz
  File "/home/greenpi/noetic_ws/devel_isolated/rviz/lib/python3/dist-packages/rviz/__init__.py", line 34, in <module>
    exec(__fh.read())
  File "<string>", line 25, in <module>
ImportError: cannot import name 'librviz_sip' from partially initialized module 'rviz' (most likely due to a circular import) (/home/greenpi/noetic_ws/devel_isolated/rviz/lib/python3/dist-packages/rviz/__init__.py)

I tried using pyside, but it also fails with the same error for librviz_shiboken.

Can you guide me as to what could be wrong with my build or how I can workaround this issue? Is the python_binding not built properly?

environment

rhaschke commented 6 months ago

If you found https://ros.packages.techfak.net, I don't understand why you built ROS from source. This package repo provides pre-compiled debs for most ROS1 packages. However, I checked with my ROS One distro: rviz doesn't seem to compile (or at least install) the python bindings. Need to check later, why.

programmeddeath1 commented 6 months ago

Hi as I had mentioned in an earlier question I had raised where rviz was not able to access the GPU, the device I am running on is arm64 based and the pre-compiled debs are for either x86 or amd64 and hence it showed it is not installable in my SBC device.

I observed that the sip and shiboken folders inside rviz are not getting compiled even though CmakeLists.txt is defined. It is thus not creating Librviz_sip.so files compared to my ros-noetic installation on my laptop in ubuntu 20.04.

rhaschke commented 6 months ago

I looked into this and noticed that python bindings were accidentally disabled in #1813 for no valid reason. Fixed now.