labstreaminglayer / pylsl

Python bindings (pylsl) for liblsl
MIT License
136 stars 57 forks source link

pip installer broken - find_liblsl_libraries() doesn't find binary with name 'lib' #56

Closed hgrw closed 1 year ago

hgrw commented 1 year ago

find_liblsl_libraries() doesn't find binary with name 'lib'

On ubuntu 22, using pipenv for dependency management, version 2022.7.4

Steps to reproduce

  1. $ pip install pylsl
  2. run python interpreter and import pylsl

Error RuntimeError: LSL binary library file was not found. Please make sure that the binary file can be found in the package lib folder

Cause observe that pip installer creates binary file called 'lib'. find_liblsl_libraries() needs a .so file.

Temporary fix $ mv $SITE_PACKAGES/pylsl/lib $SITE_PACKAGES/pylsl/liblsl.so $ mkdir $SITE_PACKAGES/pylsl/lib $ mv $SITE_PACKAGES/pylsl/liblsl.so $SITE_PACKAGES/pylsl/lib

Long term fix fix pip installer so that binary is called liblsl.so not lib

cboulay commented 1 year ago

pip installer creates binary file called 'lib'

Can you elaborate on this? That shouldn't be happening. The pip installer on non-Windows platforms should not have any binaries. The liblsl binaries are supposed to be retrieved separately.

What version of pylsl is this installing?

hgrw commented 1 year ago

With a fresh (pipenv) environment, I can see that no binary is installed. Nonetheless, I still get the same runtime error RuntimeError: LSL binary library file was not found. It's looking in ...site-packages/pylsl/lib. If no binary is supposed to be installed, why is it looking for one?

pylsl version: 1.16.0

Job is failing here: https://gitlab.com/hgrw/mico/-/jobs/2731724633 docker file is here: https://gitlab.com/hgrw/mico/-/blob/main/docker/Dockerfile pipenv file is here: https://gitlab.com/hgrw/mico/-/blob/main/Pipfile

cboulay commented 1 year ago

The Windows and Mac wheels ship with a binary. At one point there was a Linux wheel too and that shipped with a binary, but it became too difficult to keep up with the manylinux requirements. Even though we were able to meet the requirements of the manylinux checkers, there were some distros that were incompatible and the presence of the binary actually made it much harder for those users.

So now, in Linux at least, we don't ship a binary and expect the user to install liblsl separately. https://github.com/sccn/liblsl/releases

The error message that you're seeing should be much longer:

LSL binary library file was not found. Please make sure that the binary file can be found in the package lib folder or the system search path. Alternatively, specify the PYLSL_LIB environment variable.

Focus on the system search path or PYLSL_LIB environment variable part, not the package lib folder.

cboulay commented 1 year ago

I added some info to the README. Please let me know whether you think this is sufficient.

https://github.com/labstreaminglayer/liblsl-Python/blob/master/README.md#liblsl-dependency

hgrw commented 1 year ago

Yep, no problem - thanks