respeaker / 4mics_hat

GNU General Public License v2.0
33 stars 28 forks source link

kws_doa.py: cannot import name 'snowboydetect' #1

Closed ChrisWeiss closed 6 years ago

ChrisWeiss commented 6 years ago

I copied the snowboy directory from the mic_array project and followed the build instructions - I'm still getting the following error:

(env) pi@raspberrypi:~/4mics_hat $ python kws_doa.py 
Traceback (most recent call last):
  File "kws_doa.py", line 13, in <module>
    from voice_engine.kws import KWS
  File "/home/pi/env/lib/python3.5/site-packages/voice_engine/kws.py", line 5, in <module>
    from .kws_snowboy import KWS
  File "/home/pi/env/lib/python3.5/site-packages/voice_engine/kws_snowboy.py", line 14, in <module>
    from snowboy import snowboydetect
ImportError: cannot import name 'snowboydetect'

I have the following bits in the 4mics_hat folder (went ahead and created a camel-case symlink just in case):

drwxr-xr-x  8 pi pi    4096 Oct 13 01:54 snowboy
-rw-r--r--  1 pi pi 2629458 Oct 13 01:00 snowboy-1.2.0b1-py2-none-any.whl
lrwxrwxrwx  1 pi pi      19 Oct 13 01:55 snowboydetect -> snowboy/swig/Python
lrwxrwxrwx  1 pi pi      19 Oct 13 02:04 SnowboyDetect -> snowboy/swig/Python
-rw-r--r--  1 pi pi 2267666 Oct 13 01:00 webrtc_audio_processing-0.0.1-cp27-cp27mu-linux_armv7l.whl

Have the following in snowboy/swig/Python:

(env) pi@raspberrypi:~/4mics_hat $ ls -al snowboy/swig/Python
total 1480
drwxr-xr-x 2 pi pi    4096 Oct 13 01:56 .
drwxr-xr-x 9 pi pi    4096 Oct 13 01:54 ..
-rw-r--r-- 1 pi pi      28 Oct 13 01:56 __init__.py
-rw-r--r-- 1 pi pi    2505 Oct 13 01:54 Makefile
-rw-r--r-- 1 pi pi    4857 Oct 13 01:54 snowboydetect.py
-rwxr-xr-x 1 pi pi 1048736 Oct 13 01:54 _snowboydetect.so
-rw-r--r-- 1 pi pi  157660 Oct 13 01:54 snowboy-detect-swig.cc
-rw-r--r-- 1 pi pi     525 Oct 13 01:54 snowboy-detect-swig.i
-rw-r--r-- 1 pi pi  273612 Oct 13 01:54 snowboy-detect-swig.o

Still a bit of a python n00b - What am I missing?

KillingJacky commented 6 years ago

Hi, did you go through this wiki? http://wiki.seeed.cc/ReSpeaker_4_Mic_Array_for_Raspberry_Pi/ I think you should install the snowboy python module with command

pi@raspberrypi:~ $ source ~/env/bin/activate                    # activate the virtual, if we have already activated, skip this step
(env) pi@raspberrypi:~ $ cd ~/4mics_hat
(env) pi@raspberrypi:~/4mics_hat $ sudo apt install libatlas-base-dev     # install snowboy dependencies
(env) pi@raspberrypi:~/4mics_hat $ sudo apt install python-pyaudio        # install pyaudio
(env) pi@raspberrypi:~/4mics_hat $ pip install ./snowboy*.whl             # install snowboy for KWS
(env) pi@raspberrypi:~/4mics_hat $ pip install ./webrtc*.whl              # install webrtc for DoA
(env) pi@raspberrypi:~/4mics_hat $ cd ~/
(env) pi@raspberrypi:~ $ git clone https://github.com/voice-engine/voice-engine
(env) pi@raspberrypi:~ $ cd voice-engine/
(env) pi@raspberrypi:~/voice-engine $ python setup.py install

The commands are all referred from the wiki page I mentioned above.

KillingJacky commented 6 years ago

Will close this issue, please open a new issue if you have further questions.