ModuleNotFoundError: No module named '_impl' & ImportError: numpy.core.multiarray failed to import

I am facing with two errors, 1 is a numpy failing to import (I have open a new issue in numpy github as per the instructions in the error command line) and another is a ModuleNotFoundError.

I am currently running on Rasbian Buster on a Raspberry Pi4 4GB, using python 3.7 and numpy v1.17.3.

Below is the code I enter which I follow from the github page.
deepspeech --model deepspeech-0.5.1-models/output_graph.pbmm --alphabet deepspeech-0.5.1-models/alphabet.txt --lm deepspeech-0.5.1-models/lm.binary --trie deepspeech-0.5.1-models/trie --audio audio/2830-3980-0043.wav

The error is as listed:
Traceback (most recent call last):
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/numpy/core/init.py”, line 17, in
from . import multiarray
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/numpy/core/multiarray.py”, line 14, in
from . import overrides
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/numpy/core/overrides.py”, line 7, in
from numpy.core._multiarray_umath import (
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/numpy/init.py”, line 142, in
from . import core
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/numpy/core/init.py”, line 47, in
raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy c-extensions failed.

  • Try uninstalling and reinstalling numpy.

  • If you have already done that, then:

    1. Check that you expected to use Python3.7 from “/home/pi/tmp/deepspeech-venv/bin/python3”,
      and that you have no directories in your PATH or PYTHONPATH that can
      interfere with the Python and numpy version “1.17.3” you’re trying to use.
    2. If (1) looks fine, you can open a new issue at
      https://github.com/numpy/numpy/issues. Please include details on:
      • how you installed Python
      • how you installed numpy
      • your operating system
      • whether or not you have multiple versions of Python installed
      • if you built from source, your compiler versions and ideally a build log
  • If you’re working with a numpy git repository, try git clean -xdf
    (removes all files not under version control) and rebuild numpy.

Note: this error has many possible causes, so please don’t comment on
an existing issue about this - open a new one instead.

Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory

Traceback (most recent call last):
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/deepspeech/impl.py”, line 14, in swig_import_helper
return importlib.import_module(mname)
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 670, in _load_unlocked
File “”, line 583, in module_from_spec
File “”, line 1043, in create_module
File “”, line 219, in _call_with_frames_removed
ImportError: numpy.core.multiarray failed to import

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/pi/tmp/deepspeech-venv/bin/deepspeech”, line 5, in
from deepspeech.client import main
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/deepspeech/init.py”, line 23, in
from deepspeech.impl import PrintVersions as printVersions
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/deepspeech/impl.py”, line 17, in
_impl = swig_import_helper()
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/deepspeech/impl.py”, line 16, in swig_import_helper
return importlib.import_module(’_impl’)
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/importlib/init.py”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named ‘_impl’

It’s the same error, despite the two different exceptions. When you fix your numpy installation the other error should go away as well.

I am unable to fix the numpy error. I have tried uninstalling and reinstalling numpy and python as well. Currently my python version is 3.7.3 and numpy is 1.17.3 which should be correct for deepspeech. Or could it be that i should not use deepspeech v0.6.a11 for running deepspeech v0.5.1? If so, can you please instruct me on how to install deepspeech v0.5.1 as running
pip3 install deepspeech==0.5.1 yields an error as pip cannot find the version

Have you run this: pip3 install -r requirements.txt (see training.rst). It will help much for installing dependences. (You should remove numpy and try)

You will not be able to use the v0.5.1 models with a v0.6 alpha build. I don’t think we had Pi4 builds for v0.5.1, hence why pip install doens’t work. You’ll have to wait for us to release v0.6 stable or train a model yourself for testing.

But this is not the reason why it’s failing, that’s still the numpy installation. You should focus on the source of the problem if you want to fix it:

You should not need to build numpy on RPi4, there are wheels existing: https://www.piwheels.org/simple/numpy/

This is only useful for training. Please avoid polluting the virtualenv with useless dependencies.

That’s right, Buster is Python 3.7, we only added that post 0.5.

Ok, I reformatted everything and reinstall deepspeech. The numpy error does not appear this time. However there’s another error that appeared.

Loading model from file deepspeech-0.5.1-models/output_graph.pbmm
TensorFlow: v1.14.0-18-g351a98a
DeepSpeech: v0.6.0-alpha.11-0-gf3694ef
ERROR: Model provided has model identifier ‘�x;’, should be ‘TFL3’

Error at reading model file deepspeech-0.5.1-models/output_graph.pbmm
Traceback (most recent call last):
File “/home/pi/tmp/deepspeech-venv/bin/deepspeech”, line 8, in
sys.exit(main())
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/deepspeech/client.py”, line 71, in main
ds = Model(args.model, args.alphabet, args.beam_width)
File “/home/pi/tmp/deepspeech-venv/lib/python3.7/site-packages/deepspeech/init.py”, line 45, in init
raise RuntimeError(“CreateModel failed with error code {}”.format(status))
RuntimeError: CreateModel failed with error code 12288

I’m guessing this is because of deepspeech v0.6 alpha is unable to use v0.5.1 model?

Numpy is install automatically when using the command

pip3 install deepspeech

Is there any tutorial to train my own model using deepspeech and google colab? Because I dont think Raspberry Pi4 is able to train a model right?

This is more because you are passing the protobuf and not the tflite model as argument.

Yes, but it should the linked wheel, not build locally.

I think someone did that.

No, you need powerful GPUs.