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

Cannor load DLL on WIndows #124

Open
giohappy opened this issue Nov 29, 2024 · 8 comments
Open

Cannor load DLL on WIndows #124

giohappy opened this issue Nov 29, 2024 · 8 comments

Comments

@giohappy
Copy link

giohappy commented Nov 29, 2024

Python 3.11.9 on Windows 11.
Signalflow fails when imprted.

This is the output when traced with dlltracer

>>> import dlltracer
>>> import sys
>>> with dlltracer.Trace(out=sys.stdout):
...     import signalflow
...
LoadLibrary C:\Windows\System32\kernel.appcore.dll
LoadLibrary C:\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow\signalflow.pyd
LoadLibrary C:\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow.libs\msvcp140-1ba8f0cd5a79973275397a73667e85ff.dll
LoadLibrary C:\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow.libs\sndfile-b0a52daf2e1c2a2cef4f74c8d536c443.dll
LoadLibrary C:\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow.libs\libfftw3f-3-3bdf804532d690cae74ca3fdac981db6.dll
Failed \Device\HarddiskVolume5\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow.libs\sndfile-b0a52daf2e1c2a2cef4f74c8d536c443.dll
Failed \Device\HarddiskVolume5\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow.libs\libfftw3f-3-3bdf804532d690cae74ca3fdac981db6.dll
Failed \Device\HarddiskVolume5\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow.libs\msvcp140-1ba8f0cd5a79973275397a73667e85ff.dll
Failed \Device\HarddiskVolume5\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow\signalflow.pyd
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "C:\Users\giohappy\AppData\Local\Programs\Python\Python311\Lib\site-packages\signalflow\__init__.py", line 20, in <module>
    from .signalflow import *
ImportError: DLL load failed while importing signalflow: The specified module could not be found.

The libraries are correctly installed where the tracer reports them.

By the way, inspecting the pyd library it looks like it links tp Python 3.10. Maybe this is the problem?

image

@ideoforms
Copy link
Owner

I had another report of this which was eventually resolved… Do you happen to be running a 32-bit version of Python or otherwise in a 32-bit environment? The library is currently only built for 64-bit architectures, so I suspect this might be the issue.

@giohappy
Copy link
Author

@ideoforms I'm on a 64 bit machine with Python 64 bit. I also hoped that was the reason, but no.

@hockinsk
Copy link

hockinsk commented Dec 1, 2024

This issue came back for me in a new venv. Looking at signalflow.pyd in Dependencies, signalflow's init.py is failing because the paths to the the .dlls don't seem to have resolved perhaps? I would have thought the .pyd should be resolving the paths to: \Lib\site-packages\signalflow.libs\name.dll

One quick resolution is simply copy the .dll's from signalflow.libs and place them in the \Lib\site-packages\signalflow directory, then: from signalflow import * should work.

Here you can see the three files in signalflow.pyd haven't been found, which is correct, they don't exist in the same directory as signalflow.pyd.

image

This is the error i get:

Traceback (most recent call last):
  File "C:\Users\skhoc\Documents\DANU\test.py", line 8, in <module>
    from signalflow import *
  File "C:\Users\skhoc\Documents\DANU\venv\Lib\site-packages\signalflow\__init__.py", line 21, in <module>
    from .signalflow import *
ImportError: DLL load failed while importing signalflow: The specified module could not be found.

Another way that should work is do this where you're importing signalflow:

import os

libs_dir = r"C:\Users\skhoc\Documents\DANU\venv\Lib\site-packages\signalflow.libs"
os.add_dll_directory(libs_dir)

# Try importing signalflow
try:
    from signalflow import *
    print("signalflow imported successfully")
except ImportError as e:
    print(f"ImportError: {e}")
except OSError as e:
    print(f"OSError: {e}")

@hockinsk
Copy link

hockinsk commented Dec 2, 2024

Actually, it makes no difference copying then to signalflow dir, it still doesn't find the three .dll.

@hockinsk
Copy link

hockinsk commented Dec 2, 2024

I thought I'd have a nose in signalflow.pyd hex to see what the dll paths were and found a lot of ascii error output related to JACK? Didn't expect to see that, i'm sure it's not related to this dll issue, but wasn't what I expected to find so sharing anyway.

I just removed all C++ redistributable, removed python, removed visual studio, installed python, installed signalflow but still errors the module can't be found.

image

@hockinsk
Copy link

hockinsk commented Dec 2, 2024

Rolling back to signalflow 0.4.4 works on same system. I notice there's a soundio .dll in soundflow.libs that doesn't exist in the 0.5.1 latest version, but assume this is handled differently now?

Then running pip install --upgrade signalflow to 0.5.1 appears to work too, it's just the fresh install directly to 0.5.1 has the issue? Weird.

PS C:\Users\skhoc\Documents\DANU> pip show signalflow
Name: signalflow
Version: 0.5.1
Summary: SignalFlow is a sound synthesis library designed for clear and concise expression of sonic ideas
Home-page:
Author: Daniel Jones
Author-email: [email protected]
License:
Location: C:\Users\skhoc\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires: numpy
Required-by:

@ideoforms
Copy link
Owner

That's so strange. You're right, soundio.dll shouldn't be needed anymore. I'm travelling at the moment, but will take a look at the DLLs sometime when I'm back at my Windows computer next week.

@hockinsk
Copy link

hockinsk commented Dec 7, 2024

Great stuff. Probably looking at differences between 0.4.4 > 0.5.1 pip upgrade versus a fresh 0.5.1 install might show the issue because the upgrade path (using .whl instead of pip) seems to work.

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

3 participants