pylsl icon indicating copy to clipboard operation
pylsl copied to clipboard

Having trouble importing pylsl

Open devaka40 opened this issue 5 years ago • 7 comments

Hi everyone, I having trouble importing pylsl. Everytime I try to import it I get:

Traceback (most recent call last): File "C:/Users/computer/PycharmProjects/pythonProject1/MuseRead.py", line 33, in import pylsl File "C:\Users\computer\PycharmProjects\pythonProject1\venv\lib\site-packages\pylsl_init_.py", line 2, in from .pylsl import IRREGULAR_RATE, DEDUCED_TIMESTAMP, FOREVER, cf_float32,
File "C:\Users\computer\PycharmProjects\pythonProject1\venv\lib\site-packages\pylsl\pylsl.py", line 1217, in lib = CDLL(libpath) File "C:\Users\computer\AppData\Local\Programs\Python\Python37\lib\ctypes_init_.py", line 364, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application

I'm tried looking at the installation guide for pylsl and the only thing I can see is to use pip install pylsl which is what I used.

Thanks in advance to everyone that helps.

devaka40 avatar Aug 09 '20 09:08 devaka40

I am getting the same error.

rakeshbci avatar Sep 13 '20 07:09 rakeshbci

Traceback (most recent call last): File "time1.py", line 1, in from pylsl import StreamInlet, resolve_stream File "C:\Users\rakes\AppData\Local\Programs\Python\Python38\lib\site-packages\pylsl_init_.py", line 2, in from .pylsl import IRREGULAR_RATE, DEDUCED_TIMESTAMP, FOREVER, cf_float32,
File "C:\Users\rakes\AppData\Local\Programs\Python\Python38\lib\site-packages\pylsl\pylsl.py", line 1217, in lib = CDLL(libpath) File "C:\Users\rakes\AppData\Local\Programs\Python\Python38\lib\ctypes_init_.py", line 373, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application

rakeshbci avatar Sep 13 '20 08:09 rakeshbci

Same goes here:

Traceback (most recent call last): File "", line 1, in File "C:\Users\user1\anaconda3\lib\site-packages\pylsl_init_.py", line 2, in from .pylsl import IRREGULAR_RATE, DEDUCED_TIMESTAMP, FOREVER, cf_float32,
File "C:\Users\user1\anaconda3\lib\site-packages\pylsl\pylsl.py", line 1217, in lib = CDLL(libpath) File "C:\Users\user1\anaconda3\lib\ctypes_init_.py", line 373, in init self._handle = _dlopen(self._name, mode) OSError: [WinError 193] %1 is not a valid Win32 application

bboylalu avatar Oct 01 '20 14:10 bboylalu

@bboyalu I got my problem solved, I had a rogue DLL in my system. Add a print(libpath) immediately before the lib = CDLL(libpath) line and try to import pylsl again? The location should match with the python library location where pylsl is present.

Rakesh420 avatar Oct 02 '20 02:10 Rakesh420

@Rakesh420 Ah, yes, thank you so much! For some reason it was pointing to the Muse SDK installation folder, C:\Program Files (x86)\Muse\lsl.dll. I uninstalled the Muse SDK and now I can import pylsl without any issue.

I think this is the piece of code that does that, but Muse SDK's lsl.dll is not working in this situation. path = util.find_library('lsl' + bitness + debugsuffix) or \ util.find_library('liblsl' + bitness + debugsuffix)

bboylalu avatar Oct 02 '20 13:10 bboylalu

@bboylalu I had the same issue with the Muse SDK. I deleted the lsl.dll in the Muse folder. And when the printed the libpath, it showed in the proper directory. Now pylsl is working in my computer.

rakeshbci avatar Oct 02 '20 14:10 rakeshbci

This repo should be archived. Please use https://github.com/labstreaminglayer/liblsl-Python

cboulay avatar Jul 22 '22 22:07 cboulay