Code Monkey home page Code Monkey logo

Comments (23)

sciguy14 avatar sciguy14 commented on July 22, 2024 1

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 [email protected]
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
#35 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AArT78rGIFfHvT5_cqFTfhO6-g5NRaGdks5qZOV4gaJpZM4JTTau
.

Jeremy E. Blum
Blum Idea Labs LLC.
www.jeremyblum.com
[email protected]

Check out my book: Exploring Arduino http://www.exploringarduino.com

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

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 :-)

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

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.

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

@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.

from snowboy.

 avatar commented on July 22, 2024

getting the same error,
root@raspberrypi:~/AlexaPi# python start.py Alexa.pmdl
Traceback (most recent call last):
File "start.py", line 2, in
import main
File "/root/AlexaPi/main.py", line 24, in
import snowboydecoder
File "/root/AlexaPi/snowboydecoder.py", line 6, in
import snowboydetect
File "/root/AlexaPi/snowboydetect.py", line 28, in
_snowboydetect = swig_import_helper()
File "/root/AlexaPi/snowboydetect.py", line 20, in swig_import_helper
import _snowboydetect
ImportError: No module named _snowboydetect

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 "

Compile a Python Wrapper

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

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

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.

from snowboy.

 avatar commented on July 22, 2024

curious to see if anyone had any luck getting this going on the devel branch?

from snowboy.

Darkein avatar Darkein commented on July 22, 2024

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 :(

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

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.

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

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.

from snowboy.

tadly avatar tadly commented on July 22, 2024

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?

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

@tadly we build the Python module using swig through this Makefile. The default does not link ATLAS statically.

from snowboy.

tadly avatar tadly commented on July 22, 2024

@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

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

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

from snowboy.

tadly avatar tadly commented on July 22, 2024

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 :)

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

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 :-)

from snowboy.

nyboer avatar nyboer commented on July 22, 2024

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

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

@nyboer hi yes you will have to link swig to your installed version (we are using swig 3.0.10).

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

I believe the issue has been resolved, so closing this. Critical points are:

  1. Make sure swig 3.0.10 is used in the Makefile
  2. Make sure python-config in the Makefile is linked to your python3 instead of python2

from snowboy.

ppirrip avatar ppirrip commented on July 22, 2024

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.

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

When you were compiling for Python3, did you make sure the python-config you used was for Python3 instead of Python2?

from snowboy.

ppirrip avatar ppirrip commented on July 22, 2024

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

from snowboy.

chenguoguo avatar chenguoguo commented on July 22, 2024

It's is different.

Finding python-config is really a python question instead of Snowboy. Please try some searches on Google.

from snowboy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.