Kitt-AI / snowboy

Future versions with model training module will be maintained through a forked version here: https://github.com/seasalt-ai/snowboy
Other
3.11k stars 1.01k forks source link

ubuntu 16.04 -ImportError: No module named 'snowboydetect' #303

Open gokul-gokz opened 7 years ago

gokul-gokz commented 7 years ago

I have downloaded the snowboy package from github. I have followed the instruction and installed it as per it. I have also installed all the dependencies. But when i run the python example ,it throws the error

File "demo2.py", line 1, in import snowboydecoder File "/home/asimov/google_speech_ws/node_modules/snowboy/examples/Python3/snowboydecoder.py", line 5, in import snowboydetect ImportError: No module named 'snowboydetect'

I am using python3. I have tried with python 2.7 as well but the same error.

I have cross checked the swig installation and it's version is also 4.0.

I have also ran the command make install inside swig directory and it has installed without any errors.

How to resove this ?

chenguoguo commented 7 years ago

Did you compile the Python library under swig/Python or swig/Python3?

seymout commented 6 years ago

Hi, I believe I'm getting the same error. What steps should I take to compile the Python library under swig/Python3 after cloning the current repo?

chenguoguo commented 6 years ago
cd swig/Python3
make

Make sure you have swig 3.0.10 or above installed. You may have to edit the Makefile to make sure you are using the correct version of swig.

Thedush commented 5 years ago

youtube link:

https://www.youtube.com/watch?v=mUEm05ZAhhI&t=84s

1."""Install Packages""" sudo apt-get install sox libpcre3 libpcre3-dev libatlas-base-dev && sudo pip install pyaudio

2."""Compile a supported swig version (3.0.10 or above)"""

Create path snowboy and open it in terminal

Download the tar file from http://downloads.sourceforge.net/swig...

tar -xvzf swig-3.0.10.tar.gz && cd swig-3.0.10/ &&
./configure --prefix=/usr \ --without-clisp \ --without-maximum-compile-warnings && make && sudo make install && sudo install -v -m755 -d /usr/share/doc/swig-3.0.10 && sudo cp -v -R Doc/* /usr/share/doc/swig-3.0.10 && cd .. 3."""Compile""" git clone https://github.com/Kitt-AI/snowboy && cd snowboy/swig/Python && make

Open /snowboy/snowboy/examples/Python/snowboydecoder.py

Change from "from . import snowboydetect" to "import snowboydetect"

Save it

4."""How to use"" create a project folder in some else in your system assume you name it as project_snowboy

Copy files from "/snowboy/snowboy/swig/Python" to project_snowboy

Copy folder "resourses" from /snowboy/snowboy to project_snowboy

Copy file "snowboydecoder.py" from "/snowboy/snowboy/examples/Python" to project_snowboy

Open "https://snowboy.kitt.ai/" , login & register ,create and download your voice model

Copy your voice model to project_snowboy

Now you can use snowboy module in python file from this path

Now you are in project_snowboy

There are many files that are not required for the project you can delete that file

/home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/resources /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/demo.py /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/Read.me /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/saya.pmdl /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydecoder.py /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydecoder.pyc /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydetect.py /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydetect.pyc /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/_snowboydetect.so

This much file is enough to run the project

cd resources

resources folder : common.res cd ..

/home path will be changed as per system

this file has to be present in the folder

Andergraw commented 5 years ago

youtube link:

https://www.youtube.com/watch?v=mUEm05ZAhhI&t=84s

1."""Install Packages""" sudo apt-get install sox libpcre3 libpcre3-dev libatlas-base-dev && sudo pip install pyaudio

2."""Compile a supported swig version (3.0.10 or above)"""

Create path snowboy and open it in terminal

Download the tar file from http://downloads.sourceforge.net/swig...

tar -xvzf swig-3.0.10.tar.gz && cd swig-3.0.10/ && ./configure --prefix=/usr --without-clisp --without-maximum-compile-warnings && make && sudo make install && sudo install -v -m755 -d /usr/share/doc/swig-3.0.10 && sudo cp -v -R Doc/* /usr/share/doc/swig-3.0.10 && cd .. 3."""Compile""" git clone https://github.com/Kitt-AI/snowboy && cd snowboy/swig/Python && make

Open /snowboy/snowboy/examples/Python/snowboydecoder.py

Change from "from . import snowboydetect" to "import snowboydetect"

Save it

4."""How to use"" create a project folder in some else in your system assume you name it as project_snowboy

Copy files from "/snowboy/snowboy/swig/Python" to project_snowboy

Copy folder "resourses" from /snowboy/snowboy to project_snowboy

Copy file "snowboydecoder.py" from "/snowboy/snowboy/examples/Python" to project_snowboy

Open "https://snowboy.kitt.ai/" , login & register ,create and download your voice model

Copy your voice model to project_snowboy

Now you can use snowboy module in python file from this path

Now you are in project_snowboy

There are many files that are not required for the project you can delete that file

/home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/resources /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/demo.py /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/Read.me /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/saya.pmdl /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydecoder.py /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydecoder.pyc /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydetect.py /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/snowboydetect.pyc /home/asimov/Navaneeth_ws/snowboy_test/project_snowboy/_snowboydetect.so

This much file is enough to run the project

cd resources

resources folder : common.res cd ..

/home path will be changed as per system

this file has to be present in the folder

It helped me to finally compile. Thank you very much,