Rosanswers logo


I am trying to install ros on a slackware based distribution. I am following the instructions given on this page http://wiki.ros.org/indigo/Installation/Source

I am trying to do a staged installation. i.e. first I install in a temporary directory temp/opt/ros/indigo and then copy the resulting temp/opt/ros/indigo/ folder to the /opt/ros/indigo folder. I am able to compile ros without problems.

I source the setup.bash file from /opt/ros/indigo/ after that.

roscore also runs fine.

But when I run rostopic

I get the Error.

Traceback (most recent call last):
  File "/opt/ros/indigo/bin/rostopic", line 35, in <module>
  File "/opt/ros/indigo/lib64/python2.7/site-packages/rostopic/__init__.py", line 1752, in rostopicmain
    import rosbag
  File "/opt/ros/indigo/lib64/python2.7/site-packages/rosbag/__init__.py", line 33, in <module>
    from .bag import Bag, Compression, ROSBagException, ROSBagFormatException, ROSBagUnindexedException
  File "/opt/ros/indigo/lib64/python2.7/site-packages/rosbag/bag.py", line 64, in <module>
    import roslz4
  File "/opt/ros/indigo/lib64/python2.7/site-packages/roslz4/__init__.py", line 33, in <module>
    from _roslz4 import *
ImportError: No module named _roslz4

All other commands seem to have no problems. But the ros-commands where _roslz4 is imported the above error comes up.

Originally posted by arp on ROS Answers with karma: 172 on 2014-11-12

Post score: 0

Original comments

Comment by William on 2014-11-12:
Seems like you don't have rosbag compiled with lz4 support, but it might also be related to the fact that you are relocating the result before using it. Can you source the setup file in the temp directory and see if you have the same problem?

Comment by arp on 2014-11-13:
I sourced the setup.bash from the install_isolated directory and I still face the same problem. About compiling I didn't get any errors. When I source the /opt/ros/indigo/setup.bash file, isn't it supposed to set the env variables appropriately?

Comment by William on 2014-11-13:
If you get the same problem from the install_isolated directory then maybe it is passing silently even though it did not find lz4 at build time. Look at the build logs for rosbag and rosbag_storage.

Comment by arp on 2014-11-13:
The problem seems occur only for indigo. I installed hydro. After sourcing hydro's setup.bash rostopic doesn't complain about _roslz4. I checked the CMakeOutput.log for indigo installation in the build_isolated directory. At the end it check for this function BZ2_bzCompressInit. Is it for lz4??


1 Answer 1


Rosanswers logo

It looks like that on your slackware based distribution the folder structure is different then on Ubuntu. On Ubuntu the shared library is place in the following location:


Since you system uses lib64 it will likely not have the right paths set. Can you please check where the shared library is for you?

If you modify your environment variable accordingly it should be able to import the shared library correctly. May this needs modification to work well out-of-box on you distribution. Please consider providing a pull request if you can figure out how you distro is different the Ubuntu.

Since the lz4 compression is a new feature of ros bags in Indigo it does work for you in Hydro.

Originally posted by Dirk Thomas with karma: 16276 on 2014-11-13

This answer was ACCEPTED on the original site

Post score: 0

Original comments

Comment by arp on 2014-11-14:
The _roslz4.so is located at:


When I source /setup.bash the above path is correctly added to PYTHONPATH. But rostopic does not find it and I get ImportError.

Comment by arp on 2014-11-14:
Ok. I got it working by moving the shared library _roslz4.so to /lib64/python2.7/site-packages/ roslz4/. I was wondering shouldn't python look for for _roslz4.so once /lib/python2.7/site-packages is on the PYTHONPATH??

Comment by arp on 2014-11-17:
Should I convert the above as answer? I have still not figured out how to make it work by just adjusting the PYTHONPATH. It works though, just by moving the _roslz4.so shared library.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.