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

'rostopic' and other commands fail after upgrade

asked 2013-03-31 15:57:12 -0600

Gav gravatar image

I've got an issue after upgrading my machines where I can't run rostopic or other key ros commands.

I foolishly ran 'sudo apt-get update && sudo apt-get upgrade' on both robots and my workstation without checking upgrading didn't break anything, and they're all displaying the same behavior, so I'm certain it's not my config.

Here's what I get when I try and run 'rostopic':

turtlebot@turtleVM:~$ rostopic
Traceback (most recent call last):
  File "/opt/ros/groovy/bin/rostopic", line 34, in <module>
    import rostopic
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rostopic/__init__.py", line 58, in <module>
    import rospy
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in <module>
    from .client import spin, myargv, init_node, \
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/client.py", line 59, in <module>
    import rospy.impl.init
  File "/opt/ros/groovy/lib/python2.7/dist-packages/rospy/impl/init.py", line 107, in <module>
    class RosStreamHandler(rosgraph.roslogging.RosStreamHandler):
AttributeError: 'module' object has no attribute 'RosStreamHandler'

My .bashrc doesn't have anything super special in it, here's the end:

source /opt/ros/groovy/setup.bash
. /opt/ros/groovy/stacks/turtlebot/setup_kobuki.sh
export TURTLEBOT_3D_SENSOR=asus_xtion_pro
export ROS_MASTER_URI="http://localhost:11311"
export ROS_MASTER_URI="http://bert:11311"

Some other enviornment variables that might be relevant: ROS_DISTRO is 'groovy' PYTHONPATH is /opt/ros/groovy/lib/python2.7/dist-packages $PYTHON_CODE_BUILD_ROS_PACKAGE_PATH is set to 'from __future__ import print_function import os env_name = 'CMAKE_PREFIX_PATH' paths = [path for path in os.environ[env_name].split(os.pathsep)] if env_name in os.environ and os.environ[env_name] != '' else [] workspaces = [path for path in paths if os.path.exists(os.path.join(path, '.catkin'))] paths = [] for workspace in workspaces: filename = os.path.join(workspace, '.catkin') data = '' with open(filename) as f: data = f.read() if data == '': paths.append(os.path.join(workspace, 'share')) paths.append(os.path.join(workspace, 'stacks')) else: for source_path in data.split(';'): paths.append(source_path) print(os.pathsep.join(paths))'

Don't know where that last one came from, but it looks like it's something quite deliberate.

My default python is 2.7.3, and if I run it and type 'import ros' it finds the package.

Any ideas what to check or how to get my system working again?

Thanks, Gavin

edit retag flag offensive close merge delete

Comments

1

What happens when you get rid of the source of setup_kobuki.sh?

jbohren gravatar image jbohren  ( 2013-03-31 18:40:55 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
8

answered 2013-04-01 06:50:37 -0600

I had this same problem and it turns out that apt-get was holding back an update to the ros-groovy-rosgraph package.

Check the packages that are held back by running $sudo apt-get upgrade, and if it is held back, $sudo aptitude safe-upgrade --full-resolver, should force it to install.

edit flag offensive delete link more

Comments

Thanks! Held back packages seem to be the problem. My system didn't have aptitude on there, but running 'sudo apt-get dist-upgrade' solved it, and I believe turtlebot-dashboard was holding stuff back.

For others, note: 'dist-upgrade' is a dangerous command, so check man pages before running it.

Gav gravatar image Gav  ( 2013-04-02 15:32:11 -0600 )edit

Indeed, 'apt-get dist upgrade' should be a last resort.

jetdillo gravatar image jetdillo  ( 2013-04-21 20:57:22 -0600 )edit
3

answered 2013-04-21 21:12:49 -0600

jetdillo gravatar image

updated 2013-04-21 21:19:59 -0600

I ran into this as well and fixed it by looking at the list of held-back packages:

The following packages have been kept back:

  ros-groovy-actionlib ros-groovy-common-msgs ros-groovy-geometry
  ros-groovy-nodelet-core ros-groovy-pluginlib ros-groovy-ros
  ros-groovy-ros-comm ros-groovy-ros-tutorials ros-groovy-rosgraph
0 upgraded, 0 newly installed, 0 to remove and 9 not upgraded.
ubuntu@arm:~/catkin_ws$

I did a manual 'apt-get install ros-groovy-actionlib', which succeeded. That apparently released all the others except ros-groovy-rosgraph, because now apt-get upgrade reported:

The following packages have been kept back:
  ros-groovy-rosgraph
The following packages will be upgraded:
  ros-groovy-common-msgs ros-groovy-geometry ros-groovy-nodelet-core
  ros-groovy-pluginlib ros-groovy-ros ros-groovy-ros-comm
  ros-groovy-ros-tutorials
7 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 42.3 kB of archives.
After this operation, 66.6 kB of additional disk space will be used.
Do you want to continue [Y/n]? Y

Now I could apt-get install ros-groovy-rosgraph to finish the job. I was able to get roscore running successfully after this.

So there are a couple points here I guess:

  1. I was able to get my Groovy install to a point where it could run roscore using the above procedure.

  2. I didn't have to do a 'dist-upgrade' to get this all working.

  3. Fixing install order dependencies for individual packages (if they occur) is preferable to breaking your whole OS install if a dist-upgrade goes bad for some reason.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-03-31 15:57:12 -0600

Seen: 1,494 times

Last updated: Apr 21 '13