Cannot install Python bindings

Hi, there

I followed the instruction in
native_client/README.rst to build deepspeech on a jetson xavier.

Transcribe an audio file this part has been confirmed and it works fine.

deepspeech --model deepspeech-0.5.1-models/output_graph.pbmm --lm deepspeech-0.5.1-models/lm.binary --trie deepspeech-0.5.1-models/trie --audio audio/2830-3980-0043.wav

Now I am try to make the sample work mic_vad_streaming
realizing I will also need to build the Python bindings.

And error came like:
pip3 install ./deepspeech-0.5.1-cp27-cp27mu-linux_aarch64.whl
ERROR: deepspeech-0.5.1-cp27-cp27mu-linux_aarch64.whl is not a supported wheel on this platform.

Sorry I am pretty new to python, am I doing something thing wrong with the building for deepspeech?

Python 3.6.8 (default, Oct 7 2019, 12:59:55)
[GCC 8.3.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

from pip._internal.pep425tags import get_supported
get_supported()
[(‘cp36’, ‘cp36m’, ‘manylinux2014_aarch64’), (‘cp36’, ‘cp36m’, ‘linux_aarch64’), (‘cp36’, ‘abi3’, ‘manylinux2014_aarch64’), (‘cp36’, ‘abi3’, ‘linux_aarch64’), (‘cp36’, ‘none’, ‘manylinux2014_aarch64’), (‘cp36’, ‘none’, ‘linux_aarch64’), (‘cp35’, ‘abi3’, ‘manylinux2014_aarch64’), (‘cp35’, ‘abi3’, ‘linux_aarch64’), (‘cp34’, ‘abi3’, ‘manylinux2014_aarch64’), (‘cp34’, ‘abi3’, ‘linux_aarch64’), (‘cp33’, ‘abi3’, ‘manylinux2014_aarch64’), (‘cp33’, ‘abi3’, ‘linux_aarch64’), (‘cp32’, ‘abi3’, ‘manylinux2014_aarch64’), (‘cp32’, ‘abi3’, ‘linux_aarch64’), (‘py3’, ‘none’, ‘manylinux2014_aarch64’), (‘py3’, ‘none’, ‘linux_aarch64’), (‘cp36’, ‘none’, ‘any’), (‘cp3’, ‘none’, ‘any’), (‘py36’, ‘none’, ‘any’), (‘py3’, ‘none’, ‘any’), (‘py35’, ‘none’, ‘any’), (‘py34’, ‘none’, ‘any’), (‘py33’, ‘none’, ‘any’), (‘py32’, ‘none’, ‘any’), (‘py31’, ‘none’, ‘any’), (‘py30’, ‘none’, ‘any’)]

Thank you in advance for your time and support.

The bindings are published on PyPI, just do pip install deepspeech==0.5.1 as the documentation says.

Pypi does not supports Aarch64: https://pypi.org/project/deepspeech/#files

I don’t know what you did, since you have not shared your steps. But installing using pip3 and a cp27 package feels wrong: you are mixing Python 3 and Python 2.7. This would not work.

We only have Python 3.5 support for Aarch64 on 0.5.1, because this is targetting only ARMbian distribution. And we have Python 3.7 for 0.6.0a14.

@kumakichi Either cross-compile with the proper Python version, or share us more details on the distribution you are running on this Jetson Xavier.

@lissyx
Hi lissyx, thanks for the reply.

We only have Python 3.5 support for Aarch64 on 0.5.1, because this is targetting only ARMbian distribution. And we have Python 3.7 for 0.6.0a14.

Does this mean it should work by downgrading Python from 3.68 or 3.7 to 3.5 and build the python binding again?
As you may see in the log I am using Python 3.68

Either cross-compile with the proper Python version

it was built natively on Xavier (←this should have any bad effect right?)
following steps in
https://github.com/mozilla/DeepSpeech/blob/master/native_client/README.rst

cd native_client/python
make bindings
pip install dist/deepspeech*

is there a way to specify python version to 3 when making the bindings?
Maybe I used the wrong version of python?

Sorry I can’t show you all the details right away, I will add more info tomorrow.
Thank you for your time.

This means that if you can install Python 3.5 or 3.7 (preferably 3.7, but this is for the 0.6 model), you can use pre-built wheels, you just have to pip install with the .whl URL from the release page.

This is unsupported. And you still don’t document what distribution you are using.

Use a python 3 (the one you want to use) virtualenv when doing the build.

Hi lissyx,

you can use pre-built wheels, you just have to pip install with the .whl URL from the release page.

I will try my luck there.

This is unsupported. And you still don’t document what distribution you are using.

I thought it would work, and it actually did. The cmd below did give me the correct text.

deepspeech --model deepspeech-0.5.1-models/output_graph.pbmm --lm deepspeech-0.5.1-models/lm.binary --trie deepspeech-0.5.1-models/trie --audio audio/2830-3980-0043.wav

And you still don’t document what distribution you are using.

I am using the https://developer.nvidia.com/embedded/jetpack
4.2.2, I think it is a nvidia-modified ubuntu 18.04.

Use a python 3 (the one you want to use) virtualenv when doing the build.

The build of bindings can also be done in virtual environment?
https://github.com/mozilla/DeepSpeech/blob/master/native_client/README.rst doesnt elaborate this.

Anyway, thanks again, I will try tomorrow and update the result.

I’m just stating this is not how we support it, not that it won’t work.

We expect people who want to re-build to be a bit knowledgeable, and we cannot document all and every possible setup. Using virtualenv is kinda standard …

Hi lissyx

Some how I managed to install the requiremets and the built whl file.
Thank you for your help. Please forgive my ignorance of python.

$ source ./bin/activate
(deepspeech-gpu-venv)$ python2 -m pip install -r requirements.txt

log: Successfully installed backports.shutil-get-terminal-size-1.0.0 colorama-0.4.1 cursor-1.3.4 enum34-1.1.6 halo-0.0.28 log-symbols-0.0.14 numpy-1.16.5 pyaudio-0.2.11 scipy-1.2.2 six-1.13.0 spinners-0.0.23 termcolor-1.1.0 webrtcvad-2.0.10

(deepspeech-gpu-venv)$ python2.7 -m pip install /mnt/nvme0n1/build_tensorflow/DeepSpeech/native_client/python/dist/deepspeech-0.5.1-cp27-cp27mu-linux_aarch64.whl

but when executing
(deepspeech-gpu-venv)$ python2.7 mic_vad_streaming.py --model ./deepspeech-0.5.1-models/output_graph.pbmm --lm ./deepspeech-0.5.1-models/lm.binary --trie ./deepspeech-0.5.1-models/trie

I got error like this:
File “mic_vad_streaming.py”, line 226
help=f"Input device sample rate. Default: {DEFAULT_SAMPLE_RATE}. Your device may require 44100.")

I tried to used the .wav file or specify the sound device index, and the error persisted.

specify device->
$ python2.7 mic_vad_streaming.py --model ./deepspeech-0.5.1-models/output_graph.pbmm --lm ./deepspeech-0.5.1-models/lm.binary --trie ./deepspeech-0.5.1-models/trie --device 2

with audio file->
python2.7 mic_vad_streaming.py --file audio/2830-3980-0043.wav --model ./deepspeech-0.5.1-models/output_graph.pbmm --lm ./deepspeech-0.5.1-models/lm.binary --trie ./deepspeech-0.5.1-models/trie

cat /proc/asound/cards
0 [tegrahdagalent1]: tegra-hda-galen - tegra-hda-galen-t194
tegra-hda-galen-t194 at 0x3518000 irq 68
1 [tegrasndt19xmob]: tegra-snd-t19x- - tegra-snd-t19x-mobile-rt565x
tegra-snd-t19x-mobile-rt565x
2 [USB ]: USB-Audio - Jabra SPEAK 410 USB
Jabra SPEAK 410 USB at usb-3610000.xhci-4.1, full speed

Any idea of this? thank you.

Your error is unreadable because of lack of code formatting usage.

Can you try on Python 3.6 or higher?

Hi lissyx

It worked! Thank you VERY MUCH for your help!
Sorry I am still using the 2.7 version python,
#I really need GPU support and am not sure the if the version of aarch in the release page has support for that or not.

**1.After removing the **help/error catch? part

parser.add_argument('-d', '--device', type=int, default=None   **remove help=**)
parser.add_argument('-r', '--rate', type=int, default=DEFAULT_SAMPLE_RATE)
parser.add_argument('-nf', '--n_features', type=int, default=N_FEATURES)
parser.add_argument('-nc', '--n_context', type=int, default=N_CONTEXT)
parser.add_argument('-la', '--lm_alpha', type=float, default=LM_ALPHA)
parser.add_argument('-lb', '--lm_beta', type=float, default=LM_BETA)
parser.add_argument('-bw', '--beam_width', type=int, default=BEAM_WIDTH)

2.add VADAudia,self to super

class VADAudio(Audio):
def __init__(self, aggressiveness=3, device=None, input_rate=None):
    **super(VADAudio,self)**.__init__(device=device, input_rate=input_rate)

3.import queue to

import Queue as queue

4.referred to your past link:
https://github.com/mozilla/DeepSpeech/issues/2450#issuecomment-544203820
Model of deepspeech required more parameters.

model = deepspeech.Model(ARGS.model, ARGS.n_features, ARGS.n_context, ARGS.alphabet, ARGS.beam_width)

5.execution command

python2.7 mic_vad_streaming.py -v 0 --model ./deepspeech-0.5.1-models/output_graph.pbmm --lm ./deepspeech-0.5.1-models/lm.binary --trie ./deepspeech-0.5.1-models/trie -a ./deepspeech-0.5.1-models/alphabet.txt

log

(deepspeech-gpu-venv) xkm@xkm-xavier:~/Desktop/deep_speech$ python2.7 mic_vad_streaming.py -v 0 --model ./deepspeech-0.5.1-models/output_graph.pbmm --lm ./deepspeech-0.5.1-models/lm.binary --trie ./deepspeech-0.5.1-models/trie -a ./deepspeech-0.5.1-models/alphabet.txt
Initializing model…
INFO:root:ARGS.model: ./deepspeech-0.5.1-models/output_graph.pbmm
INFO:root:ARGS.alphabet: ./deepspeech-0.5.1-models/alphabet.txt
TensorFlow: v1.13.1-13-g174b4760eb
DeepSpeech: v0.5.1-0-g4b29b78
2019-11-14 17:02:14.541389: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:965] ARM64 does not support NUMA - returning NUMA node zero
2019-11-14 17:02:14.541628: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties:
name: Xavier major: 7 minor: 2 memoryClockRate(GHz): 1.5

Recognized:
Recognized: thank you for your help

I’m unsure what you are meaning here. We only provide CUDA on Windows/AMD64 and Linux/AMD64 builds.

I’m unsure what you are meaning here. We only provide CUDA on Windows/AMD64 and Linux/AMD64 builds.

I know there are no deep-gpu version for aarch in release page, and if I want to use one, I will need to build right?
OK I understand now.

Yes, unfortunately. You should try and do cross-compilation for this, though, building on the board will likely take days (CUDA builds are much much bigger and even on desktop they take 3-4 times as CPU builds).

I know @elpimous_robot did that “”“recently”"", but we don’t really have had time to explore this ourselves, so I can’t guide you there.

Actually the one I installed is the one I built on Xavier last weekend.
It did take one one night to do so.
#cuda support on and tensorRT off<- otherwise error occours.
If someone would need the wheel file, please contact me, could save you sometime.

It would be more useful, honestly, if you could contribute with cross-compilation, with doc and/or checking our current doc.

I should have a Jetson Xavier soon,
So, I’ll do a “more actual” tuto. about install from source.
Lissyx, perhaps I’ll have a few questions😉

1 Like

Don’t hesitate to create a new tutorial with CUDA and cross-compilation :smiley: