ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

rosserial "ImportError: No module named serial"

asked 2016-07-05 18:32:55 -0600

bsculley gravatar image

updated 2016-07-07 01:50:59 -0600

gvdhoorn gravatar image

I am trying to follow the rosserial tutorial. I am running Debian 8.5 on Beaglebone Black. I installed rosserial from source using the following:

git clone
cd <ws>

This ran fine with no errors, got lots of files and directories with "rosserial" in the name :)

Then I'm ready to test, command (from tutorial) is:

rosrun rosserial_python /dev/ttyUSB0

result is:

Traceback (most recent call last):
  File "/home/debian/ros_catkin_ws/src/rosserial/rosserial_python/nodes/", line 39, in <module>
    from rosserial_python import SerialClient, RosSerialServer
  File "/home/debian/ros_catkin_ws/devel/lib/python2.7/dist-packages/rosserial_python/", line 35, in <module>
  File "<string>", line 1, in <module>
  File "/home/debian/ros_catkin_ws/src/rosserial/rosserial_python/src/rosserial_python/", line 44, in <module>
    from serial import *
ImportError: No module named serial

All help will be appreciated.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-07-06 16:37:29 -0600

ahendrix gravatar image

It looks like you don't have the python serial module installed; did you install the dependencies for rosserial when you built it?

You can install all of the dependencies for rosserial with rosdep (this should install python-serial):

cd <ws>
rosdep install --from-paths src -i

That should install python-serial, and any other dependencies. If it doesn't, you can install the python serial module by hand with:

sudo apt-get install python-serial
edit flag offensive delete link more


Thanks for your helpful answer. apt-get install worked for me. That solved the immediate problem which has now moved on to "ImportError: diagnostic_msgs". I tried to use the same type of apt-get solution but it didn't work. Neither could I find good instructions to build it from source.

bsculley gravatar image bsculley  ( 2016-07-06 17:44:50 -0600 )edit

The real answer here was to use rosdep, because it should install all of the dependencies. Did you try it?

ahendrix gravatar image ahendrix  ( 2016-07-06 18:47:54 -0600 )edit

I tried the rosdep install command you cited above, but it failed with:

ERROR: the following packages/stacks could not have their rosdep keys resolved to system dependencies: rosserial_python: No definition of [diagnostic_msgs] for OS [debian]

bsculley gravatar image bsculley  ( 2016-07-07 16:32:42 -0600 )edit

That's odd. diagnostic_msgs should be part of a standard ROS install; how did you install ROS?

ahendrix gravatar image ahendrix  ( 2016-07-07 17:05:15 -0600 )edit

from source, using the instructions here:

bsculley gravatar image bsculley  ( 2016-07-08 15:00:35 -0600 )edit

Question Tools


Asked: 2016-07-05 18:32:55 -0600

Seen: 4,087 times

Last updated: Jul 07 '16