Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load Python extension for LZ4 support #2

Closed
tyagi86 opened this issue Sep 30, 2020 · 9 comments
Closed

Failed to load Python extension for LZ4 support #2

tyagi86 opened this issue Sep 30, 2020 · 9 comments

Comments

@tyagi86
Copy link

tyagi86 commented Sep 30, 2020

Importing "bagpy" throws the following message:
"Failed to load Python extension for LZ4 support. LZ4 compression will not be available."

This results in the following error when trying to read messages/topics from rosbag file:
"rosbag.bag.ROSBagException: unsupported compression type: lz4"

System OS: Windows 10
Python Version: 3.8.3

@rahulbhadani
Copy link
Member

Can you try installing lz4?

pip install lz4

@tyagi86
Copy link
Author

tyagi86 commented Sep 30, 2020

It's installed.

lz4==3.1.0

@rahulbhadani
Copy link
Member

I don't have a windows machine currently, so it will be hard to debug. In Ubuntu "Failed to load Python extension for LZ4 support. LZ4 compression will not be available." is a warning and yet it runs. You can provide a minimum viable code snippet to reproduce your issue and that may help.

@rahulbhadani
Copy link
Member

rahulbhadani commented Oct 12, 2020

@tyagi86 I have a suggestion on reading bag files. You can use Google Colab if you don't have access to Linux. See the example: https://colab.research.google.com/drive/1ZNeVcYmvd6WHgXvdfi-MD6pdZAjWTyqZ?usp=sharing

@julienguegan
Copy link

Hello, if someone have a solution on windows I would be also interested !

I have multiples files of ~2/3 GB to read so google colab does not seem to be a good solution as I would have to upload them ...

@rahulbhadani
Copy link
Member

@tyagi86 @julienguegan
I checked on a Windows system.

  1. Here are the following steps that I performed:
  2. I installed Anaconda and ran its Jupyter Server. Then in the notebook, I installed bagpy using the following command:
!pip install bagpy --user
  1. Restarted the kernel and executed the following code:
import bagpy
import pandas as pd
from bagpy import bagreader
b = bagreader("C:\\Users\\rahulbhadani\\Downloads\\2019-10-11-19-42-06.bag")
speed_file = b.message_by_topic('/vehicle/vel')
speed = pd.read_csv(speed_file)

fig, ax = bagpy.create_fig(1)
ax[0].scatter( x = 'Time', y = 'twist.linear.x', data = speed, s = 3, marker = 'o', label = 'Original Speed')
ax[0].legend()
ax[0].set_xlabel('Time')
ax[0].set_ylabel('m/s')
fig.show()

and I was able to see the plot I was expecting.

Note that I still get Failed to load Python extension for LZ4 support. LZ4 compression will not be available., but that's just a warning and it didn't hinder me from doing any downstream analysis.

@rahulbhadani
Copy link
Member

Also, @tyagi86 @julienguegan
Do an update of a package

!pip install -U py3rosmsgs

and the warning/error message will go away.

@rahulbhadani
Copy link
Member

rahulbhadani commented Oct 16, 2020

One final thing. If your bag file uses lz4 compression, then in Windows, bagpy will not be able to decode that, as .so file for lz4 compression works only on Linux. For windows, an equivalent of .so compression is .dll file. Generating a .dll file is beyond the scope of my package. However, you can install the Ubuntu subsystem on windows and still be able to read .bag file from the Ubuntu subsystem.

With that, I am closing this issue.

@ManChrys ManChrys mentioned this issue Jul 23, 2021
@TIAN-Xiao
Copy link

try this:
pip install roslz4 --extra-index-url https://rospypi.github.io/simple/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants