Search code examples
pythonlinuxros

ImportError: No module named gobject


I installed ros1 and created a catkin workspace. Inside the src folder I cloned a ros package "executive_smach_visualization". But when I try to run it with the following command I am getting an error.

rosrun smach_viewer smach_viewer.py

Traceback:

wxversion 2.8 is not installed, installed versions are ['3.0-gtk3']
Traceback (most recent call last):
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 77, in <module>
from smach_viewer import xdot
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/__init__.py", line 1, in <module>
import wxxdot
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/wxxdot.py", line 22, in <module>
from xdot import *
File "/home/developer/catkin_ws/src/executive_smach_visualization/smach_viewer/src/smach_viewer/xdot/xdot.py", line 34, in <module>
import gobject
ImportError: No module named gobject

I have already tried following:

1) Installed goobject using pip

2) cloned gobject from git to src folder of catkin_ws, catkin_make and setup.bash

What could be the problem? Please let me know if I am missing any important input. Thanks in advance.


Solution

  • This issue occurs if there is different version of ros, python and so on.

    It seems package is a little bit outdated.

    Edit:

    After downloading package and when building your working environment, use:

    catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so
    

    Please refer to 1.5 section (User configuration) of this guide