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

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

If it is just for testing, why don’t you start a Google colab and install via pip. This is done in 2 minutes.

32 bits? 64 bits?

we said no screenshots

we also don’t support conda, please use vanilla venv.

“followed this website”, no link, no steps, I don’t have time

Being a student is not an excuse, it’s not like we have not been patient and repeatedly tried.

Python version 3.8 and 3.9 both are 64bit

I already used that but same thing.

Didn’t gave the link as I gave the code but here it is if you need it.

I can’t deny the fact that after all that you guys are still helping thanks a lot

I have to implement it in an app that is why I am using pycharm

Well, I can only ask you to re-try from scratch without any pycharm, conda or anything, and using only our deepspeech facing CLI.

Basically follow https://deepspeech.readthedocs.io/en/v0.9.3/USING.html#using-the-python-package.

I need you to be 10000% sure about that. 99% of the dll failure on Windows were tracked to python 32 bits, the other 99% to wrong CUDA dependencies.

At some point, if it’s still failing, there’s basically nothing I can do, investigating DLL loading issues is non trivial and likely to be out of your scope of knowledge, unfortunately.

Can you also verify it’s not just missing redistribuable c++ as documented here https://deepspeech.readthedocs.io/en/v0.9.3/USING.html#using-a-pre-trained-model ?

Have a look at this project, which distributes DS and seems to work for people:

1 Like

I tried that aswell but it didnt worked out same error

I am 100000% sure about that. As I reinstalled both of them and both were 64 bit, I also double checked it in cmd.

That is one of the first things I did before I asked on this forum

Maybe I should just drop the Idea of using deepspeech though I will try @othiele shared post. also have you checked the image in the main post.(the linked text saying this)

It might give a hint to you.