Installation problems DeepSpeech inference

I’m trying to run DeepSpeech on my Linux Mint 20.
My Python version: Python 3.8.2, Procesor: AMD Ryzen 3 3200G.
I’d like to run tensorflow CPU only for now because I don’t have GPU with CUDA yet. So what I did is:

pip3 install deepspeech

Then downloaded mic_vad_streaming And after that I ran:

`pip3 install -r requirements.txt`

Had some error with webrtcvad~=2.0.10, so I changed it to webrtcvad-wheels~=2.0.10.

After that I did this:

pip3 install tensorflow`

And finally with models from deepspeech 0.7.4 downloaded:

`python3 mic_vad_streaming.py -m deepspeech-0.7.4-models.pbmm -s deepspeech-0.7.4-models

Initializing model…
INFO:root:ARGS.model: deepspeech-0.7.4-models.pbmm
TensorFlow: v1.15.0-24-gceb46aa
DeepSpeech: v0.7.4-0-gfcd9563
2020-07-18 12:04:10.432985: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
INFO:root:ARGS.scorer: deepspeech-0.7.4-models
Traceback (most recent call last):
File “mic_vad_streaming.py”, line 224, in
main(ARGS)
File “mic_vad_streaming.py”, line 166, in main
model.enableExternalScorer(ARGS.scorer)
File “/home/cybersolus/.local/lib/python3.8/site-packages/deepspeech/init.py”, line 88, in enableExternalScorer
raise RuntimeError(“EnableExternalScorer failed with ‘{}’ (0x{:X})”.format(deepspeech.impl.ErrorCodeToErrorMessage(status),status))
RuntimeError: EnableExternalScorer failed with ‘Invalid scorer file.’ (0x2002)

I don’t know how to fix it.

Please format your post, it is hard to see anything.

Judging from the error message, did you download the scorer? And put everything in a virtual env

You’re right. I forgot about venv. But now I can’t install pyaudio on my virtual environment. On linux mint I should use apt-get install python3-pyaudio which I installed already, but on my venv pip3 shows:

deepspeech 0.7.4
numpy 1.19.0
pip 20.0.2
pkg-resources 0.0.0
setuptools 44.0.0

pip3 install pyaudio gives me an error:

Collecting pyaudio
  Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
  Building wheel for pyaudio (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/cybersolus/Cybersolus/Voice/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7srr5duy/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7srr5duy/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-38djlgox
       cwd: /tmp/pip-install-7srr5duy/pyaudio/
  Complete output (6 lines):
  usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
     or: setup.py --help [cmd1 cmd2 ...]
     or: setup.py --help-commands
     or: setup.py cmd --help
  
  error: invalid command 'bdist_wheel'
  ----------------------------------------
  ERROR: Failed building wheel for pyaudio
  Running setup.py clean for pyaudio
Failed to build pyaudio
Installing collected packages: pyaudio
    Running setup.py install for pyaudio ... error
    ERROR: Command errored out with exit status 1:
     command: /home/cybersolus/Cybersolus/Voice/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7srr5duy/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7srr5duy/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-e_l9qi15/install-record.txt --single-version-externally-managed --compile --install-headers /home/cybersolus/Cybersolus/Voice/include/site/python3.8/pyaudio
         cwd: /tmp/pip-install-7srr5duy/pyaudio/
    Complete output (16 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    copying src/pyaudio.py -> build/lib.linux-x86_64-3.8
    running build_ext
    building '_portaudio' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/cybersolus/Cybersolus/Voice/include -I/usr/include/python3.8 -c src/_portaudiomodule.c -o build/temp.linux-x86_64-3.8/src/_portaudiomodule.o
    src/_portaudiomodule.c:28:10: fatal error: Python.h: Nie ma takiego pliku ani katalogu
       28 | #include "Python.h"
          |          ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/cybersolus/Cybersolus/Voice/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7srr5duy/pyaudio/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7srr5duy/pyaudio/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-e_l9qi15/install-record.txt --single-version-externally-managed --compile --install-headers /home/cybersolus/Cybersolus/Voice/include/site/python3.8/pyaudio Check the logs for full command output.

A virtual env doesn’t change your server. If it worked before, it should now. Check that everything works and follow the docs linked here for package versions

https://discourse.mozilla.org/t/what-and-how-to-report-if-you-need-support/62071/2

Traceback (most recent call last):
  File "mic_vad_streaming.py", line 6, in <module>
    import pyaudio
ModuleNotFoundError: No module named 'pyaudio'

On my host (outside virtual env) pip3 list shows:
PyAudio 0.2.11

But in venv it is not available.

Did you create the virtual env as described in the docs and check your python version in- and outside the env.

Yes, I created virtual env as described in the docs and even ran this example with success:

deepspeech --model deepspeech-0.7.4-models.pbmm --scorer deepspeech-0.7.4-models.scorer --audio audio/2830-3980-0043.wav

But I want to use my microphone, not recorded wav files.

My Python version inside and outside the env are the same - 3.8.2.

Looks like you’ll need to look into compiling pyaudio yourself or you switch back to Python 3.6. That’ll probably have a wheel.

Not a DeepSpeech problem, sorry.

1 Like

I had to install python3-dev first.

Same error inside venv

Initializing model...
INFO:root:ARGS.model: deepspeech-0.7.4-models.pbmm
TensorFlow: v1.15.0-24-gceb46aa
DeepSpeech: v0.7.4-0-gfcd9563
2020-07-18 13:47:29.092161: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
INFO:root:ARGS.scorer: deepspeech-0.7.4-models
Traceback (most recent call last):
  File "mic_vad_streaming.py", line 224, in <module>
    main(ARGS)
  File "mic_vad_streaming.py", line 166, in main
    model.enableExternalScorer(ARGS.scorer)
  File "/home/cybersolus/Cybersolus/Voice/lib/python3.8/site-packages/deepspeech/__init__.py", line 88, in enableExternalScorer
    raise RuntimeError("EnableExternalScorer failed with '{}' (0x{:X})".format(deepspeech.impl.ErrorCodeToErrorMessage(status),status))
RuntimeError: EnableExternalScorer failed with 'Invalid scorer file.' (0x2002)

Okay, never mind. It worked!

1 Like

2020-10-30 14:30:11.199583: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library ‘cudart64_101.dll’; dlerror: cudart64_101.dll not found
2020-10-30 14:30:11.247284: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
Traceback (most recent call last):
File “mic_vad_streaming.py”, line 8, in
import webrtcvad
ModuleNotFoundError: No module named ‘webrtcvad’

As always:

https://discourse.mozilla.org/t/what-and-how-to-report-if-you-need-support/62071/2

looks like you are trying to use GPU version but lack CUDA 10.1

have you properly followed the example’s readme? since it documents pip steps that defines https://github.com/mozilla/DeepSpeech-examples/blob/r0.8/mic_vad_streaming/requirements.txt#L3 so either you have not followed the doc, or it failed to install the dep.

1 Like


deep speech deploying in raspberry pi with python api, please anyone how to slove it

Please don’t hijack old threads, delete your post and start a new thread without images. This is just spamming the threads.