Reputation: 255
I'm trying to import a module (UHD) into Python 2.7 from a network location. Whenever I do the import I get the following error:
ImportError: DLL load failed: The specified module could not be found
The initial import calls an init.py script that imports the other libraries. The first library import in the init script throws this error at the following line, which is also the first line of code within that file:
from . import libpyuhd as lib
libpyuhd
is a .pyd file in the same directory as other files for this module.
The interesting thing is that I can import this fine from one computer (specifically the computer I built the module from source on) but when I try to run from another computer it fails.
The python executable is also stored at the network location along with the all the code I am trying to run. The only thing used in the build that isn't on the network drive is Visual Studio.
Does this error mean it can't find the .pyd file or that it can find the .pyd file but fails to import something from it?
Thank you.
Upvotes: 3
Views: 5607
Reputation: 51
I have encountered the same problem. I used Dependency Walker in order to search which were the missing dll.
I checked both : libpyuhd.pyd and uhd.dll.
By the way, the missing lib are hightlighted at the first level of hiearchy like in the snapshot : snapshot
Then I copied the dlls directly into the same directory of libpyuhd.
And then I copied the whole new UHD package directory into my site-package :
C:\Users\"YOUR_USER_NAME"\AppData\Local\Programs\Python\Python39\Lib\site-packages
I removed the PYTHONPATH from the environment variables and my PATH contains : Path
PS 1: uhd.dll is also in this directory because I followed this documentation : https://files.ettus.com/manual/page_python.html Ettus doc
PS 2 : I just finished a second installation on an other Laptop (windows 10); it's very import to copy/paste both uhd.dll and libusb-1.0.dll to the installed uhd directory (normally in the site-package dir).
Upvotes: 1
Reputation: 96
I just solved this problem so may be able to help.
This ImportError: DLL load failed
error meanslibpyuhd
is not able to find a dependent library.
What is best is to install the Dependency Walker utility and open libpyuhd
in that. It takes a few minutes to analyze all the stuff and will list all the dependent libraries and those that cannot be found comes up with a question mark.
In my case, it showed the boost python library to be missing, though I had already installed it. I just added the path to the missing library to PATH environment variable and valla! It works now.
[
Upvotes: 6