rhasspy / rhasspy-wake-raven

Wake word detection engine based on Snips Personal Wakeword Detector
MIT License
45 stars 5 forks source link

NumPy error in Docker image (2.5.4) #2

Closed repole closed 3 years ago

repole commented 4 years ago

Really excited to try this out. Unfortunately the latest Rhasspy docker image doesn't seem to want to play nice with Raven thanks to a NumPy packaging issue:

2020-07-24 06:58:14,636 INFO success: wake_word entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
Traceback (most recent call last):
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/numpy/core/__init__.py", line 22, in <module>
    from . import multiarray
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/numpy/core/multiarray.py", line 12, in <module>
    from . import overrides
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/numpy/core/overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: libopenblas.so.0: 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 "/usr/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.7/runpy.py", line 142, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/usr/lib/rhasspy/rhasspy-wake-raven-hermes/rhasspywake_raven_hermes/__init__.py", line 24, in <module>
    from rhasspywake_raven import Raven
  File "/usr/lib/rhasspy/rhasspy-wake-raven/rhasspywake_raven/__init__.py", line 10, in <module>
    import numpy as np
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/numpy/__init__.py", line 140, in <module>
    from . import core
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/numpy/core/__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError:

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

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.7 from "/usr/lib/rhasspy/.venv/bin/python3"
  * The NumPy version is: "1.19.1"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: libopenblas.so.0: cannot open shared object file: No such file or directory

2020-07-24 06:58:15,302 INFO exited: wake_word (exit status 1; not expected)
koenvervloesem commented 4 years ago

Thanks for your report. For numpy to work, you need to install:

sudo apt install libatlas3-base libgfortran5

I needed the same dependencies for Rasa on ARM.

Can you confirm that it works when you install these packages in the running Docker container?

repole commented 4 years ago

Gave that shot, seems they were already installed?

root@satellite1:/# apt install libatlas3-base libgfortran5
Reading package lists... Done
Building dependency tree
Reading state information... Done
libgfortran5 is already the newest version (9.2.1-9ubuntu2).
libgfortran5 set to manually installed.
libatlas3-base is already the newest version (3.10.3-8ubuntu5).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

Also tried running the install command mentioned in the README, which did seem to update a few things:

root@satellite1:/# apt-get install liblapack3 libatlas-base-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  libatlas-doc liblapack-doc
The following NEW packages will be installed:
  libatlas-base-dev liblapack3
0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded.
Need to get 4502 kB of archives.
After this operation, 22.0 MB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports eoan/universe armhf libatlas-base-dev armhf 3.10.3-8ubuntu5 [2883 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports eoan/main armhf liblapack3 armhf 3.8.0-2 [1619 kB]
Fetched 4502 kB in 2s (2777 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libatlas-base-dev:armhf.
(Reading database ... 13263 files and directories currently installed.)
Preparing to unpack .../libatlas-base-dev_3.10.3-8ubuntu5_armhf.deb ...
Unpacking libatlas-base-dev:armhf (3.10.3-8ubuntu5) ...
Selecting previously unselected package liblapack3:armhf.
Preparing to unpack .../liblapack3_3.8.0-2_armhf.deb ...
Unpacking liblapack3:armhf (3.8.0-2) ...
Setting up liblapack3:armhf (3.8.0-2) ...
Setting up libatlas-base-dev:armhf (3.10.3-8ubuntu5) ...
update-alternatives: using /usr/lib/arm-linux-gnueabihf/atlas/libblas.so to provide /usr/lib/arm-linux-gnueabihf/libblas.so (libblas.so-arm-linux-gnueabihf) in auto mode
update-alternatives: using /usr/lib/arm-linux-gnueabihf/atlas/liblapack.so to provide /usr/lib/arm-linux-gnueabihf/liblapack.so (liblapack.so-arm-linux-gnueabihf) in auto mode

But still got the same error after restarting Rhasspy.

Finally tried just installing the library numpy was complaining about (apt-get install libopenblas-dev), and that seemed to solve my issues. Would assume that line just needs to get thrown into the Dockerfile and things should be good to go?

koenvervloesem commented 4 years ago

Great, thanks for testing this! Yes, we'll have to install this library then in the Dockerfile.

koenvervloesem commented 4 years ago

I added this in https://github.com/rhasspy/rhasspy/commit/be756fa138431bee62fdff139bd0506d4224fb2e. @synesthesiam this should suffice to fix this, no?

synesthesiam commented 4 years ago

Awesome, thanks! I'll re-built the image and push it up. I tested this on amd64 and didn't have any issue with Raven. I wonder if there is something different in the ARM packages?