Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pocketsphinx no module named pocketsphinx found

1,284 views
Skip to first unread message

ldomp...@casema.nl

unread,
Jul 12, 2016, 4:00:51 AM7/12/16
to
I try to run an example python file for pocketsphinx but I get this error:

File "continuous_test.py", line 5, in <module>
from pocketsphinx.pocketsphinx import *
ImportError: No module named pocketsphinx

Does somebody knows how to repair this.

Peter Otten

unread,
Jul 12, 2016, 4:32:41 AM7/12/16
to
Did you install pocketsphinx successfully?

If not, well, it should be obvious that you cannot import a package that is
not installed. The pypi page lists the requirements:

https://pypi.python.org/pypi/pocketsphinx

Make sure that those for your system are fulfilled and then retry the
install.

If yes, did you create a module called pocketsphinx.py to try out the
library? Then rename your own module and remove the corresponding
pocketsphinx.pyc.

ldomp...@casema.nl

unread,
Jul 12, 2016, 4:48:01 AM7/12/16
to
Op dinsdag 12 juli 2016 10:00:51 UTC+2 schreef ldomp...@casema.nl:
I think that pocketsphinx installed successfully because I install it on my raspberry pi with sudo-apt-get
How can I create a module named pocketsphinx.py to try out the library.

Thanks

Steven D'Aprano

unread,
Jul 12, 2016, 5:07:18 AM7/12/16
to
On Tuesday 12 July 2016 18:47, ldomp...@casema.nl wrote:

> Op dinsdag 12 juli 2016 10:00:51 UTC+2 schreef ldomp...@casema.nl:
>> I try to run an example python file for pocketsphinx but I get this error:
>>
>> File "continuous_test.py", line 5, in <module>
>> from pocketsphinx.pocketsphinx import *
>> ImportError: No module named pocketsphinx
>>
>> Does somebody knows how to repair this.
>
> I think that pocketsphinx installed successfully because I install it on my
> raspberry pi with sudo-apt-get

Are you running two different versions of Python? If you are, then perhaps apt-
get installed it for the system Python, but you're running a different version.

If your Raspberry Pi is running "locate", you can run this:

locate site-packages


and it will show you all the third-party Python packages installed in the
standard location. Can you see pocketsphinx? If not, then it is not installed.

Once you are sure it is installed, try running these lines at the Python
prompt, one at a time, and tell us exactly what happens:


import pocketsphinx


If there is no error, what does this give?0

print (pocketsphinx.__file__)


(There are TWO underscores at the start and end of "file".)



> How can I create a module named
> pocketsphinx.py to try out the library.

DON'T do that. You **do not** want to create a module called "pocketsphinx.py".
If you have, that may be your problem. Call it something else, like "main.py"
or "testps.py", or "mypocketsphinx.py".




--
Steve

ldomp...@casema.nl

unread,
Jul 12, 2016, 7:33:24 AM7/12/16
to
Op dinsdag 12 juli 2016 10:00:51 UTC+2 schreef ldomp...@casema.nl:
I had python version 2.6 3.0 3.4 installed and removed.
I reinstall pocketsphinx python and now I don't get any errors while import from pocketsphinx. So I tried to run some python examples and now I get this error. I don't have a clue whats coing on.

INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='live', VARNORM='no', AGC='none'
INFO: cmn.c(97): mean[0]= 12.00, mean[1..12]= 0.0
ERROR: "acmod.c", line 83: Folder 'pocketsphinx/model/en-us/en-us' does not contain acoustic model definition 'mdef'
Traceback (most recent call last):
File "example.py", line 15, in <module>
decoder = Decoder(config)
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 271, in __init__
this = _pocketsphinx.new_Decoder(*args)
RuntimeError: new_Decoder returned -1

Steven D'Aprano

unread,
Jul 12, 2016, 7:42:23 AM7/12/16
to
On Tue, 12 Jul 2016 09:32 pm, ldomp...@casema.nl wrote:

> I reinstall pocketsphinx python and now I don't get any errors while
> import from pocketsphinx. So I tried to run some python examples and now I
> get this error. I don't have a clue whats coing on.

[...]

> RuntimeError: new_Decoder returned -1

That's a pocketsphinx error. Try reading the docs, or asking on the
pocketsphinx forums. You might be lucky and find somebody here who knows
pocketsphinx, but your best chance will come from a specialist pocketsphinx
forum.




--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

ldomp...@casema.nl

unread,
Jul 12, 2016, 2:35:34 PM7/12/16
to
Op dinsdag 12 juli 2016 10:00:51 UTC+2 schreef ldomp...@casema.nl:
I work it out with importing pocketsphinx and sphinxbase but I have an other error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Decoder

Is there a way to download the module Decoder somewhere?


0 new messages