Unable to use pylsl library

Hi, I am trying to use pylsl library to receive messages across network; however, I run into the following error:

RuntimeError: LSL library file was not found. Please make sure that the binary file can be found in the package lib folder (/home/howard-gesture/.local/lib/python3.8/site-packages/pylsl/lib)

To solve this, I tried to pip3 install pylsl, but the robot responded:

Requirement already satisfied: pylsl in ./.local/lib/python3.8/site-packages

Then I went to location /home/howard-gesture/.local/lib/python3.8/site-packages, found that the pylsl is lacking a lib file. I am not sure if this is causing the problem, and how can I fix it?

Thanks!

Hi @Hung-Te_Wu, I haven’t used this library before, but according to the PyPI page, you’ll need to install liblsl first.

From pylsl · PyPI
On all non-Windows platforms and for some Windows-Python combinations, you must first obtain a liblsl shared library. See the liblsl repo documentation for further details.

Looks like installing liblsl involves going to the project’s releases page, downloading liblsl-1.16.2-focal_amd64.deb, and installing it from the terminal using:

sudo apt install ./liblsl-1.16.2-focal_amd64.deb

In the filename, focal means Ubuntu 20.04, and jammy would mean Ubuntu 22.04, so you would download the file appropriate for the distribution installed on your robot. Other codenames are documented here.

1 Like

Hi, thanks @bshah !

Sorry, I am pretty new to the field, so these questions might be naive.

i tried the code you sent, and i’m getting
“Reading package lists… Done
E: Unsupported file ./liblsl-1.16.2-focal_amd64.deb given on commandline”


Also, I installed miniconda and successfully installed and run codes that requires pylsl library; however, I cannot run the ROS code that controls the movement of the robot when i am in the miniconda environment.


Therefore, I tried to copy the pylsl file from miniconda3/lib/python3.11/site-packages/ to .local/lib.python3.8.

And right now the error message is printed below:

Traceback (most recent call last):
File “/home/howard-gesture/.local/lib/python3.8/site-packages/pylsl/pylsl.py”, line 1320, in
libpath = next(find_liblsl_libraries())
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “listener.py”, line 2, in
from pylsl import StreamInlet, resolve_stream
File “/home/howard-gesture/.local/lib/python3.8/site-packages/pylsl/init.py”, line 2, in
from .pylsl import IRREGULAR_RATE, DEDUCED_TIMESTAMP, FOREVER, cf_float32,
File “/home/howard-gesture/.local/lib/python3.8/site-packages/pylsl/pylsl.py”, line 1329, in
raise RuntimeError(err_msg + __dload_msg)
RuntimeError: LSL binary library file was not found. Please make sure that the binary file can be found in the package lib folder
(/home/howard-gesture/.local/lib/python3.8/site-packages/pylsl/lib)
or the system search path. Alternatively, specify the PYLSL_LIB environment variable.
You can install the LSL library with conda: conda install -c conda-forge liblsl
or otherwise download it from the liblsl releases page assets: Releases · sccn/liblsl · GitHub

Thank you!

Howard

Hi @Hung-Te_Wu, if you’re still facing this issue, could you provide additional details on the software you’re installing? It might be easier for me to help, if I can go through the same steps you’re going through.

Hi @bshah , yes I am still facing this issue.

I am trying to run a Python script that uses the pylsl library. When I run the script, I received the following:

“RuntimeError: LSL library file was not found. Please make sure that the binary file can be found in the package lib folder (/home/howard-gesture/.local/lib/python3.8/site-packages/pylsl/lib)”

Therefore I tried to reinstall pylsl; however, I received the following message:

“Requirement already satisfied: pylsl in ./.local/lib/python3.8/site-packages”

Since there seem to be something wrong with either the environment or the package version (I am not quite sure) that made me unable to use the pylsl I downloaded, I installed miniconda to create a new environment to run the script. Which went successful.

But the current problem is that in the new environment (which pylsl works perfectly) I can no longer run the scripts that teleoperate the robot using the command provided on your website:

When I deactivate miniconda environment, the teleoperating scripts worked again in my base environment, so I suspect that there is a problem between the environments.

Please let me know how I could provide you with further details.

Thank you so much!

Hi @Hung-Te_Wu, it would be helpful to debug the issues you’re facing on a video call. If you’d find a debugging call helpful, please reach out to support@hello-robot.com and we can schedule a time to meet.