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

asked 2019-10-21 14:32:35 -0600

updated 2019-10-21 14:36:52 -0600

gvdhoorn gravatar image

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'
edit retag flag offensive close merge delete

Comments

1

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.

gvdhoorn gravatar imagegvdhoorn ( 2019-10-21 14:38:27 -0600 )edit