Robotics StackExchange | Archived questions

catkin_make fails Import error: no module named error for yaml library

Trying to write a subscriber node using genpy module.

The build fails:

Traceback (most recent call last):
  File "/opt/ros/kinetic/share/genpy/cmake/../../../lib/genpy/genmsg_py.py", line 44, in <module>
    import genpy.generator
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/__init__.py", line 34, in <module>
    from . message import Message, SerializationError, DeserializationError, MessageException, struct_I
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/genpy/message.py", line 44, in <module>
    import yaml
  File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 2, in <module>
    from error import *
ImportError: No module named 'error'

Asked by panda_robo_gal on 2019-10-21 14:32:35 UTC

Comments

Do you have an alternative Python intepreter installed / active? Such as Anaconda, or have Python 3 as you're default interpreter?

The ROS Python packages (for Kinetic at least) are only built for the standard, system-provided Python 2.7.x interpreter, nothing more. So alternative interpreters will not see those packages, neither their dependencies, leading to these kinds of errors.

See aso #q314971 for a similar case.

Asked by gvdhoorn on 2019-10-21 14:38:27 UTC

Answers