Ask Your Question

Install of the rospy/rosbag python libraries standalone not on Ubuntu

asked 2020-02-04 12:24:34 -0500

JohnH gravatar image

I want to be able to parse out bag files. I don't need to produce or change the bag files just read and parse them so I can use the data downstream in a couple of different systems/formats.

Using python is fine, and I am just trying to run this: import rosbag bag = rosbag.Bag('myfile.bag') for topic, msg, t in bag.read_messages(topics=['chatter', 'numbers']): print msg bag.close()

However, I can't seem to find a way to install the rosbag package.

I've tried variations of pip install rosbag.

From reading I see if I was on Ubuntu I should: sudo apt-get install python-rosbag

I don't have Ubuntu. Ideally I'd like to do this on CentOS and/or Mac OSX.

Of course, in testing on OSX, there's no apt-get and doesn't seem to be any homebrew equivalent...

Again I don't want to have to completely install ROS, just the python libs to parse the bag files.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-02-04 14:27:22 -0500

gvdhoorn gravatar image

updated 2020-02-04 15:04:42 -0500

Use the custom/experimental Pypi index from rospypi/simple:

virtualenv -p python3 venv
source ./venv/bin/activate
pip install --extra-index-url rospy rosbag

A couple of others packages might also come in handy, but that depends on what you want to do.

Also works with Python 2.

On Windows, Linux and most likely OSX as well (but I haven't tested it).

Related ROS Discourse post: Experimental Python package index for ROS.


Again I don't want to have to completely install ROS, just the python libs to parse the bag files.

seeing where you're registering from, you may be interested in this company which offers data analytics interopability tools for working with .bags (presentation at the ROS-I Conference 2019, and video recording).

I have no commercial interest here, just linking to a presentation I attended at the ROS-I Conf19 last year.

edit flag offensive delete link more


That worked. Thank you!

JohnH gravatar image JohnH  ( 2020-02-04 14:45:49 -0500 )edit

After doing this, I got the error Failed to load Python extension for LZ4 support. LZ4 compression will not be available

Kansai gravatar image Kansai  ( 2020-08-11 03:38:15 -0500 )edit

You'll want to discuss this with the maintainer of rospypi/simple.

gvdhoorn gravatar image gvdhoorn  ( 2020-08-11 07:36:11 -0500 )edit

I used the following to get rosbag working on macOS 10.15.7 Catalina with Python 3.8.5:

  1. brew install lz4
  2. brew install boost-python3
  3. pip install --extra-index-url rospy rosbag roslz4 cv-bridge
rajkundu gravatar image rajkundu  ( 2021-04-06 23:03:15 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-02-04 12:24:34 -0500

Seen: 5,433 times

Last updated: Feb 04 '20