ImportError: DLL load failed while importing _impl: A dynamic link library (DLL) initialization routine failed. (while importing deepspeech library)

I have already seen the other posts on this topic here but was not able to find the solution

I am fairly new to coding I want to use deepspeech library to convert speech to text.

I am following this tutorial: https://www.youtube.com/watch?v=c_0Q3T0XYTA

I have created and activated the virtual environment in pycharm and then installed the deepspeech module via pip.

but when I run the import deepspeech command I am getting the following error:

Traceback (most recent call last):
  File "D:\Coding\jarvis\app.py", line 1, in <module>
    import deepspeech
  File "D:\Coding\jarvis\deepspeech\lib\site-packages\deepspeech\__init__.py", line 23, in <module>
    from deepspeech.impl import Version as version
  File "D:\Coding\jarvis\deepspeech\lib\site-packages\deepspeech\impl.py", line 13, in <module>
    from . import _impl
ImportError: DLL load failed while importing _impl: A dynamic link library (DLL) initialization routine failed.

when I dig a little deeper into the code I found

this

This might help you.

Kindly tell a solution to this and if possible make it easy to understand for a beginner.

I want to make a basic voice assistant to perform some tasks. I don’t want to use the speech recognition library as it needs an online connection and adds to the latency. I want to use the pre-trained models of deepspeech and have real-time conversion. So any other suggestions will be really helpful.

Please search before posting. How does your problem differ from those of others. And check the guidelines.

I mentioned already that I did check them out but they didn’t work out for me. Also, they were old that is why I made a new post.

If you have a solution then kindly help :pray::pray:

Too bad we can’t read in your head, it looks like we won’t be able to help you.

If I knew the answer, I would have written it. DeepSpeech works fine on Windows for many users like me. You did something the others didn’t. Until you share all the info outlined in the guidelines it will be almost impossible to help you.

If you want help, then kindly follow the guidelines.

what should I do to follow the guidelines

To quote Alice in Wonderland, I suppose you should:

“Begin at the beginning,” the King said gravely, “and go on till you come to the end: then stop.”

:slightly_smiling_face:

1 Like

What?? I didn’t get you

I’m sorry, I don’t understand you.

It’s okay to be a newbie, but it’s not okay to ignore others that are replying to help you. We have already told you what we need. Until you follow the linked guidelines, there is nothing we can do.

is there anyway I could edit this topic to make it follow the guidelines
sorry for bothering you again and again

The link clearly states what you should provide, Neil even wrote the nice GatherUp so it isn’t too hard …

I want to add that info to it . Or should I just comment it?

Just comment … It’s been nearly 20 messages and there has been zero progress so far. Only time lost for everyone. So just comment.

OS and Version:- WINDOWS 10 10.0.19041 Build 19041

deepspeech version:- 0.9.3

Python Version:- 3.9 (same error on 3.8)

I am using the speech-to-text pretrained model.

Ok, I’m not interested in helping someone who is obviously here just to make us loose time. We have linked you the guidelines for gathering as much as possible of informations on your system, and you continue to make fun of us. Have a good day.

what did I do wrong now please try to understand I am not making fun of anyone I am not able to make any progress in my project. If there was a way I could do it by myself I would have already done that, I have searched google for this problem put a question on stack overflow but there a user guided me here.

here is a link for that

  • not following the required guidelines for sharing your problem
  • linking to a video tutorial not made by us: do you really expect people who want to help you viewing a video to know what you might have did wrong? I don’t have time for that
  • not sharing all the exact steps you took to reproduce your issue ; just stating “I installed using pip” is not enough, because we can’t verify what you did

Now, too bad, but I can’t spend my whole day helping you, so you have basically ran out of time with me, I need to work.

1 Like

Agreed I wouldn’t have helped a person Like that either. I am sorry to waste your and @othiele time.

But still, I am a 11-grade student wanting to complete a project before the next session starts.

so If anyhow you got time then kindly help I am writing all the thing in order I did

  1. I already had Python 3.9 so nothing for that
  2. Then I downloaded deepdpeech via this command pip install deepspeech
  3. Then I created a virtual environment in the current working directory by using the inbuilt feature in pycharm

.

  1. then I downloaded a pre-trained model deepspeech-0.9.3-models.pbmm file from the GitHub
    I also downloaded the deepspeech-0.9.3-models.scorer file from Github.

  2. Then I followed this website to make it work(I was trying to use your docs but they were not understandable by me that is why I read from there and also the video)

  3. according to them here is my code:

import deepspeech
import wave
import numpy as np

modelPath = 'D:\Coding\jarvis\deepspeech-0.9.3-models.pbmm'

model = deepspeech.Model(modelPath)

scorerPath = 'D:\Coding\jarvis\deepspeech-0.9.3-models.scorer'

model.enableExternalScorer(scorerPath)

lm_alpha = 0.75
lm_beta = 1.85
model.setScorerAlphaBeta(lm_alpha, lm_beta)

beam_width = 500
model.setBeamWidth(beam_width)


filename = 'audio/8455-210777-0068.wav'
w = wave.open(filename, 'r')
rate = w.getframerate()
frames = w.getnframes()
buffer = w.readframes(frames)
print(rate)
print(model.sampleRate())
type(buffer)

data16 = np.frombuffer(buffer, dtype=np.int16)

text = model.stt(data16)
print(text)

after that when I run I am getting this error:

Traceback (most recent call last):
  File "D:\Coding\jarvis\main.py", line 1, in <module>
    import deepspeech
  File "C:\Users\saura\AppData\Local\Programs\Python\Python39\lib\site-packages\deepspeech\__init__.py", line 23, in <module>
    from deepspeech.impl import Version as version
  File "C:\Users\saura\AppData\Local\Programs\Python\Python39\lib\site-packages\deepspeech\impl.py", line 13, in <module>
    from . import _impl
ImportError: DLL load failed while importing _impl: A dynamic link library (DLL) initialization routine failed.

I have performed all of the above steps 3-4 times now and in python version 3.8 and 3.9 but the same error always.

like @lissyx I am so fed up with this I just can’t explain so kindly help if anyone knows the answer