jasperproject / jasper-client

Client code for Jasper voice computing platform
MIT License
4.53k stars 1.01k forks source link

Error - Error: global name 'cmuclmtk' is not defined #706

Open tunjisaka opened 5 years ago

tunjisaka commented 5 years ago

Jasper AI

Hi Guys, I am using Leap on openSUSe I have installed all the dependencies for the speech module but when I run python jasper.py I keep on getting an error.

My profile.yml looks like this:

carrier: '' first_name: Tunji gmail_address: tunjisakxxx.xxx gmail_password: xxxxx last_name: Saka location: London phone_number: 07721xxxxxx prefers_email: true stt_engine: sphinx pocketsphinx: hmm_dir: 'usr/share/po timezone: GMT+0

However this is the response I get:

Please, does any body have any suggestions?

aaronchantrill commented 5 years ago

Seems like you probably just need to pip install cmuclmtk.

You say you installed all the dependencies for the speech module. Can you post a link to exactly which set of instructions you followed?

tunjisaka commented 5 years ago

Sure. I am in the process of trying to build the jasper speech project. The instructions an be found at: https://jasperproject.github.io/documentation/installation/. I have had a look at the pip install but it returns with Requirement already satisfied: cmuclmtk in /usr/lib/python3.6/site-packages

However,, when I use which cmuclmtk which: no cmuclmtk in (/sbin:/bin:/usr/sbin:/usr/bin)

I must admit even though new to unix I am finding this difficult. do you think that I have built the packages correctly?

aaronchantrill commented 5 years ago

I'm glad to hear that you are interested in this kind of project, sorry it's frustrating.

First of all, I think Jasper still uses Python2.7, so if you have installed the dependencies in python 3 then they are not going to work (python 3 changed so many things that it is basically a different language from python 2). If your system uses python3 when you type "python" or pip3 when you type "pip", then you are probably on Arch linux. You need to use python2 and pip2 instead.

try: sudo pip2 install cmuclmtk

Second, cmuclmtk is a library, not an executable. Try searching for libcmuclmtk.a: find / -name 'libcmuclmtk.a' 2>/dev/null If you can't find it, then you probably missed a sudo make install.

Last, the last time the Jasper team merged a pull request was January 2017, almost two years ago (that's a long time in computer years). I don't think it's being actively maintained (please, someone correct me if I'm wrong), and the instructions, which were always a little iffy, are now stale which makes it even more confusing and frustrating. There are other projects with similar goals that are being actively maintained, so you might want to look at them. Good luck!

G10DRAS commented 5 years ago

try below pkg https://github.com/G10DRAS/Raspbian-Jessie-Pkgs/blob/master/cmuclmtk_3alpha-1_armhf.deb install it with command sudo dpkg -i cmuclmtk_3alpha-1_armhf.deb see if it works for you...

tunjisaka commented 5 years ago

I am going to have a look at your suggestions - I am currently mobile and do not have my machine with me - however just putting this out there I am using a SUSe Leap but I should not think that makes a difference to the libraries and subsequent executable. Would it?

G10DRAS commented 5 years ago

most probably it will not work on openSUSe.

tunjisaka commented 5 years ago

Hi there G10DRAS, can I ask what makes you say that this application woll not work in openSUSe? What is it about this operating system that makes the build soo impossible?

most probably it will not work on openSUSe.

Hi there G10DRAS, can I ask what makes you say that this application woll not work in openSUSe? What is it about this operating system that makes the build soo impossible?

G10DRAS commented 5 years ago

I compiled those binary for RaspberryPi arm architecture for OS Raspbian Jessie.

aaronchantrill commented 5 years ago

I have installed this whole system on OpenSuse Tumbleweed using the instructions you referred to above:

svn co https://svn.code.sf.net/p/cmusphinx/code/trunk/cmuclmtk/
cd cmuclmtk/
./autogen.sh
make
sudo make install

These instructions build the library from source, so it should not matter what version of linux or which architecture you are on.

What I have found is that installing cmuclmtk does not always install the python wrapper, so you have to manually "pip install cmuclmtk" in order to create the link. These are two different things that both need to be installed in order for "import cmuclmtk" to work in python. This can be confusing because sometimes the pypi package will also include the base library.

Additionally, the error message you listed above was from python3, but Jasper uses python 2, so the fact that some module is or is not available in python3 doesn't say much about what Jasper will have access to.

It may be that cmuclmtk has installed to somewhere that your system isn't looking for libraries. When I do 'sudo make install' on cmuclmtk, I get:

Libraries have been installed in:
   /usr/local/lib

This is not a standard library location in linux, so you might need to add /usr/local to your /etc/ld.so.conf file and run sudo ldconfig

Anyway, after installing the cmuclmtk program, I have the following header files in /usr/local:

$ ls /usr/local/include/cmuclmtk
ac_hash.h             disc_meth_good_turing.h  genrand.h     sih.h
ac_lmfunc_impl.h      disc_meth.h              idngram2lm.h  stats.h
ac_parsetext.h        disc_meth_linear.h       mips_swap.h   toolkit.h
bo_ng_prob.h          disc_meth_witten_bell.h  miscella.h
compat.h              evallm.h                 ngram.h
disc_meth_absolute.h  general.h                pc_general.h

and the installer also installs executables to /usr/local/bin:

/usr/local/bin/text2wfreq
/usr/local/bin/wfreq2vocab
/usr/local/bin/text2idngram
/usr/local/bin/idngram2lm
/usr/local/bin/binlm2arpa
/usr/local/bin/idngram2stats
/usr/local/bin/evallm
/usr/local/bin/text2wngram
/usr/local/bin/ngram2mgram
/usr/local/bin/wngram2idngram
/usr/local/bin/mergeidngram
/usr/local/bin/lm_interpolate
/usr/local/bin/lm_combine

and shared and static libraries here:

/usr/local/lib/libcmuclmtk.la
/usr/local/lib/libcmuclmtk.a
/usr/local/lib/libcmuclmtk.so
/usr/local/lib/libcmuclmtk.so.0.0.0
/usr/local/lib/libcmuclmtk.so.0

The actual python module appears to be here:

$ ls /usr/local/lib/python2.7/dist-packages/cmuclmtk
__init__.py  __init__.pyc

(note that this is python2.7, but it is also very possible to use "pip3 install cmuclmtk" to install it for python3.x).

petterreinholdtsen commented 3 years ago

I see the same error, and the problem is really a hidden exception, which can be exposed like this:

% python -mcmuclmtk
No handlers could be found for logger "cmuclmtk"
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 163, in _run_module_as_main
    mod_name, _Error)
  File "/usr/lib/python2.7/runpy.py", line 111, in _get_module_details
    __import__(mod_name)  # Do not catch exceptions initializing package
  File "cmuclmtk/__init__.py", line 64, in <module>
    raise ImportError("CMUCLMTK command(s) missing or not in $PATH.")
ImportError: CMUCLMTK command(s) missing or not in $PATH.

So the CMUCLMTK binary need to be available for the module to load.