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

ImportError: No module named _roslz4 after Installing from source

asked 2014-11-12 06:17:48 -0500

arp gravatar image

updated 2021-12-03 09:50:52 -0500

Evgeny gravatar image

Hi,

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/Installati...

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>
    rostopic.rostopicmain()
  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.

edit retag flag offensive close merge delete

Comments

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?

William gravatar image William  ( 2014-11-12 20:23:24 -0500 )edit

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?

arp gravatar image arp  ( 2014-11-13 01:34:21 -0500 )edit

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.

William gravatar image William  ( 2014-11-13 02:18:25 -0500 )edit

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??

arp gravatar image arp  ( 2014-11-13 04:38:59 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-11-13 11:59:51 -0500

Dirk Thomas gravatar image

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:

<prefix>/lib/python2.7/dist-packages/roslz4/_roslz4.so

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.

edit flag offensive delete link more

Comments

The _roslz4.so is located at:

<prefix>/lib/python2.7/site-packages/roslz4/_roslz4.so

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

arp gravatar image arp  ( 2014-11-14 01:56:54 -0500 )edit

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

arp gravatar image arp  ( 2014-11-14 04:45:50 -0500 )edit

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.

arp gravatar image arp  ( 2014-11-17 01:22:57 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-11-12 06:17:48 -0500

Seen: 1,979 times

Last updated: Nov 13 '14