"ImportError: DLL load failed: The specified module could not be found." when running deepspeech

If you’ve found a bug, or have a feature request, then please create an issue with the following information:

  • Have I written custom code (as opposed to running examples on an unmodified clone of the repository): no custom code
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10 v1903
  • TensorFlow installed from (our builds, or upstream TensorFlow): from pip
  • TensorFlow version (use command below): 2.2.0
  • Python version: 3.7.8
  • CUDA/cuDNN version: not using GPU
  • GPU model and memory: not using GPU
  • Exact command to reproduce:
python3 -m venv .
.\Scripts\activate
pip install deepspeech
pip install tensorflow # doesn't change anything whether it's installed or not
deepspeech


Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2288.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "D:\nufflee-tts\deepspeech_try2\Scripts\deepspeech.exe\__main__.py", line 4, in <module>
  File "d:\nufflee-tts\deepspeech_try2\lib\site-packages\deepspeech\__init__.py", line 23, in <module>
    from deepspeech.impl import Version as version
  File "d:\nufflee-tts\deepspeech_try2\lib\site-packages\deepspeech\impl.py", line 13, in <module>
    from . import _impl
ImportError: DLL load failed: The specified module could not be found.

I followed the most basic deepspeech installation steps but I keep getting this error. I also installed MSVC++ redistributables but that doesn’t help either. Any help would be appreciated.

One odd thing I noticed is that it uses python from my program files, not one from my current virtual environment. Then I tried to do python -m deepspeech using python from the venv but that fails with the same error and path too.

Either the wrapper or libdeepspeech.so fails, please investigate this. I don’t know how to debug dynamic loader on Windows.

I investigated this using Dependency Walker and Process Monitor and managed to fix the issue by moving libdeepspeech.so from Lib/site-packages/deepspeech/lib/libdeepspeech.so to Lib/site-packages/deepspeech/libdeepspeech.so because that was the only place Python was looking for it in.
However, I’m sure this is not intended behaviour.

1 Like

It should be under lib, it is weird the linker does not find it there.

@Nufflee Maybe this is not working correctly in your case?
https://github.com/mozilla/DeepSpeech/blob/v0.7.4/native_client/python/__init__.py#L7-L18

Do you think you could debug around that?

can you help me I am a beginner and encountering the same issue, I dont understand what you are saying so please if there is a way to fix this that I can Understand :pray::pray:

@Saurav_Prashar You don’t read our comments in your other thread and now you are hijacking older ones.

Please delete this post and carefully read our comments on the other one.

Delete your posts here, you misunderstood. It is ok to open new threads, but you don’t provide information as requested. Last chance …

Can you please tell me what else info I should provide. I am a beginner and I dont know much about this stuff, this is probably the most difficult thing I have done and that is the reason I am not able to give you required info

Stop this. You already have opened another thread, where we already have told you what you need to do.

Now you need to read guidelines and apply, and stop replying to other threads. If you don’t, we won’t be able to help you and we will be forced to ban you.

I had the same problem but I downloaded the latest version of python (3.9.2) and the latest version of deepspeech (0.9.3) and the problem was solved.

1 Like

This issue is still present in DeepSpeech 0.9.3. I was able to solve the ImportError: DLL load failed while importing _impl: The specified module could not be found. issue by following the suggestion above i.e., by moving libdeepspeech.so from Lib/site-packages/deepspeech/lib/libdeepspeech.so to Lib/site-packages/deepspeech/libdeepspeech.so.

I was able to then successfully run the samples at quick start

This is not a fix, I’m still open to someone that reproduces the issue and can investigate why the lib/ directory is not being picked by the dynamic linker.

I am going to follow this guide. Hopefully It would help.

At the expense of repeating myself, it is not a fix. Proper analysis has to be done, but:

  • I’m not working on this project anymore
  • I’m not the most knowledgeable on Windows system.

Ok, Sorry. My bad. I was in hurry so didn’t read it carefully.

i got the same error, could you solve it?