Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tunjisaka opened this issue Dec 14, 2018 · 10 comments
Open

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

tunjisaka opened this issue Dec 14, 2018 · 10 comments

Comments

@tunjisaka
Copy link

tunjisaka commented Dec 14, 2018

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:

  •         JASPER - THE TALKING COMPUTER           *
    
  • (c) 2015 Shubhro Saha, Charlie Marsh & Jan Holthuis *

ERROR:client.vocabcompiler:Fatal compilation Error occured, cleaning up...
Traceback (most recent call last):
File "/home/sakat/jasper/client/vocabcompiler.py", line 163, in compile
self._compile_vocabulary(phrases)
File "/home/sakat/jasper/client/vocabcompiler.py", line 269, in _compile_vocabulary
vocabulary = self._compile_languagemodel(text, self.languagemodel_file)
File "/home/sakat/jasper/client/vocabcompiler.py", line 290, in _compile_languagemodel
cmuclmtk.text2vocab(text, vocab_file)
NameError: global name 'cmuclmtk' is not defined
ERROR:root:Error occured!
Traceback (most recent call last):
File "jasper.py", line 146, in
app = Jasper()
File "jasper.py", line 109, in init
stt_passive_engine_class.get_passive_instance(),
File "/home/sakat/jasper/client/stt.py", line 48, in get_passive_instance
return cls.get_instance('keyword', phrases)
File "/home/sakat/jasper/client/stt.py", line 40, in get_instance
vocabulary.compile(phrases)
File "/home/sakat/jasper/client/vocabcompiler.py", line 171, in compile
raise e
NameError: global name 'cmuclmtk' is not defined

Please, does any body have any suggestions?

@aaronchantrill
Copy link

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
Copy link
Author

tunjisaka commented Dec 18, 2018

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
Copy link

aaronchantrill commented Dec 20, 2018

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
Copy link

G10DRAS commented Dec 22, 2018

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
Copy link
Author

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
Copy link

G10DRAS commented Dec 23, 2018

most probably it will not work on openSUSe.

@tunjisaka
Copy link
Author

tunjisaka commented Jan 15, 2019

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
Copy link

G10DRAS commented Jan 22, 2019

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

@aaronchantrill
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants