Closed sciguy14 closed 7 years ago
Hi, looks like it's related to swig. We have't tested Python3 yet. I'll have a try to see if I can update my Python without breaking my existing stuff :-)
I'll leave this up for a while. I haven't figured out the best way to pass data from Python to C++ using swig without changing a lot of stuff. We are using string in Python2.x but the string object in Python3.* now holds unicode instead of bytes.
Understood. Figured that was the cause, just wanted to bring it to your attention. In the meanwhile, I'm happily using Python2.7 with Snowboy and it's working great. Every year or so, I say to myself, "Maybe it's time for me to give Python3 another shot", and then I do it, and everything breaks, and I find myself back in the warm embrace of Python2.x again.
On Mon, Jul 25, 2016 at 9:34 AM, Guoguo Chen notifications@github.com wrote:
I'll leave this up for a while. I haven't figured out the best way to pass data from Python to C++ using swig without changing a lot of stuff. We are using string in Python2.x but the string object in Python3.* now holds unicode instead of bytes.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Kitt-AI/snowboy/issues/35#issuecomment-235007677, or mute the thread https://github.com/notifications/unsubscribe-auth/AArT78rGIFfHvT5_cqFTfhO6-g5NRaGdks5qZOV4gaJpZM4JTTau .
Jeremy E. Blum Blum Idea Labs LLC. www.jeremyblum.com jeremy@jeremyblum.com
Check out my book: Exploring Arduino http://www.exploringarduino.com
@sciguy14 could you check out the devel branch and give it a shot with your python3? you will have to compile the library with your python3 dependencies using this makefile. please also make sure you use swig 3.0.10. Let me know if it works.
getting the same error,
root@raspberrypi:~/AlexaPi# python start.py Alexa.pmdl
Traceback (most recent call last):
File "start.py", line 2, in
been trying to do https://github.com/flooie/AlexaPi/ and this bit has me stumped, this is on a pi2 with the latest rasbian version (full not light)
I thought perhaps i need to install snowboy, so checked the site out,
downloaded the tar.bz2 (first time seeing that type of file)
extracted it tar xf rpi-arm-raspbian-8.0-1.0.4.tar.bz2
cd into it
read the readme....man thats one confusing readme
sudo apt-get install swig3.0 python-pyaudio python3-pyaudio sox
yep
pip install pyaudio
yep
sudo apt-get install libatlas-base-dev
yep
quote "
cd swig/Python
make
" no such folder as swig....... and there im stuck
the rec t.wav command works though...not sure if thats relevent but its hearing my mic after i followed the steps to set it up.....just cant get the main program to use the snowboydetect.py
oh if you want to compile, you have to checkout this repository https://github.com/Kitt-AI/snowboy instead of downloading the pre-compiled tarballs.
curious to see if anyone had any luck getting this going on the devel branch?
Tried with the devel branch, unfortunately got the same result.
I'm using ubuntu 16.04 x64 whose don't have swig 3.0.10 in it's repo so i recompiled it. I tried to modify the makefile to use python3-config and added -py3 parameter to swig, without success.
I don't want to going back to python 2 :(
The problem might be Ubuntu 16.04. We've only compiled Snowboy for Ubuntu 14.04 so far, so the library was only tested on 14.04 and I'm not too sure if it works on 16.04. If someone has tested it on 16.04, please let us know.
Could someone tell if if the current devel branch works on Python3? I just fixed an issue on Ubuntu 16.04 (g++ version related) so it should works on Ubuntu 16.04 now. If the Python3 is still not working, let's try to fix it.
I'd really like to test the devel branch but building this thing on archlinux is a pain (well atlas is a pain on arch) and on debian I'm kinda struggling to get it to static link the atlas stuff.
Mind telling me how you guys create the builds with atlas being statically linked?
@tadly we build the Python module using swig through this Makefile. The default does not link ATLAS statically.
@chenguoguo yeah, I know that already and did that as well. :) However I'm unable to include Atlas in the resulting build as mentioned in this inline-comment
I see, you were trying to statically link to atlas on debian. When you install atlas on debian, I think both the .a and the .so libraries are installed. Then instead of using LDLIBS := -lm -ldl -lf77blas -lcblas -llapack_atlas -latlas
, you use something like LDLIBS := -lm -ldl /usr/lib/atlas-base/libf77blas.a /usr/lib/atlas-base/libcblas.a /usr/lib/atlas-base/liblapack_atlas.a /usr/lib/atlas-base/liblatlas.a
hm.. well that was way to easy.
Spent over an hour googlen on how to force use static libs while building instead of shared ones and all I found was -Wl,-strict
which didn't quite workout for me.
Anyway, thank you very much. Building it works now and I'll do some testing tomorrow even though v1.1.0 added official python3 support which renders this issue kinda useless by now :) While on that topic, you provide precompiled binaries already. Mind adding one for 16.04 built with python3?
I can build it myself now (again, thanks for helping) but it might be generally useful for others :)
you should be able to use the 14.04 snowboy library and build it on 16.04 by yourself. we haven't thoroughly tested python3 so expect issues :-)
Working with Python 2.79 on C.H.I.P.
Installed all the dependencies.
Cloned the git, cd to snowboy/swig/Python and tried make. Swig threw an error.
I had to change the Makefile (right near the top) to
SWIG := swig3.0
For search-ability, here's the actual errors.
swig -I../../ -c++ -python -o snowboy-detect-swig.cc snowboy-detect-swig.i
make: swig: Command not found
Makefile:44: recipe for target 'snowboy-detect-swig.cc' failed
make: *** [snowboy-detect-swig.cc] Error 127
@nyboer hi yes you will have to link swig to your installed version (we are using swig 3.0.10).
I believe the issue has been resolved, so closing this. Critical points are:
This might be related. Has anything encountered this Python3 error: self.detector = snowboydetect.SnowboyDetect(common_resource, model) File "/home/ppirrip/.local/lib/python3.5/site-packages/snowboy/snowboydetect.py", line 109, in init this = _snowboydetect.new_SnowboyDetect(resource_filename, model_str) TypeError: in method 'new_SnowboyDetect', argument 1 of type 'std::string const &'
This is from the latest Raspbian and dev branch.
SWIG Version 3.0.10 Compiled with g++ [armv7l-unknown-linux-gnueabihf] Configured options: +pcre
Python2 works perfect. I try to do a work-around from python side (force the string to ascii etc.) but doesn't seem to work.
When you were compiling for Python3, did you make sure the python-config
you used was for Python3 instead of Python2?
Where is the python-config? I can't locate it anywhere. I use the make in the dir snowboy/swig/Python3
Just for sanity check, the _snowboydetect.so is different for python2 and python3
It's is different.
Finding python-config is really a python question instead of Snowboy. Please try some searches on Google.
Got it built for the pi, inside a venv. Super cool! However, although I'm able to run the demo with python 2.7, it fails when I try to run it using Python 3.4 (the default inside my virtual env).
I followed these instructions regarding getting it compiled: https://github.com/Kitt-AI/snowboy/issues/17