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

rosserial "ImportError: No module named serial"

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

bsculley gravatar image

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

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 https://github.com/ros-drivers/rosserial.git
cd <ws>
catkin_make

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 serial_node.py /dev/ttyUSB0

result is:

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

All help will be appreciated.

Bob

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

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

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

Comments

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 -0500 )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 -0500 )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 -0500 )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 -0500 )edit

from source, using the instructions here: https://gist.github.com/mhaberler/621...

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

Question Tools

Stats

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

Seen: 4,221 times

Last updated: Jul 07 '16