I'm trying to test pocketsphinx with python. I'm using Ubuntu 14.04LTS with python 2.7.
I installed sphinxbase & pocketsphenix from git yesterday. But unfortunately I'm stuck with following error.
Command:
python test.py t.wav
Output:
Traceback (most recent call last):
File "test.py", line 79, in <module>
from pocketsphinx import *
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 46, in <module>
_pocketsphinx = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 42, in swig_import_helper
_mod = imp.load_module('_pocketsphinx', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/pocketsphinx/_pocketsphinx.so: undefined symbol: ps_set_jsgf_file
This error means that python module tries to link to old pocketsphinx installed in your system in /usr/lib folder. You need to do the following:
1) Remove Ubuntu packages for sphinxbase and pocketsphinx
2) Configure linker to load libraries from /usr/local/lib folder (for example, set LD_LIBRARY_PATH or edit ld.so.conf).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to test pocketsphinx with python. I'm using Ubuntu 14.04LTS with python 2.7.
I installed sphinxbase & pocketsphenix from git yesterday. But unfortunately I'm stuck with following error.
Command:
python test.py t.wav
Output:
Traceback (most recent call last):
File "test.py", line 79, in <module>
from pocketsphinx import *
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 46, in <module>
_pocketsphinx = swig_import_helper()
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 42, in swig_import_helper
_mod = imp.load_module('_pocketsphinx', fp, pathname, description)
ImportError: /usr/local/lib/python2.7/dist-packages/pocketsphinx/_pocketsphinx.so: undefined symbol: ps_set_jsgf_file
The code I was trying to execute
!/usr/bin/python
import sys
import pocketsphinx
if name == "main":
hmdir = "/usr/local/share/pocketsphinx/model/hmm/en_US/"
lmdir = "/usr/local/share/pocketsphinx/model/lm/en_US/wsj0vp.5000.DMP"
dictd = "/usr/local/share/pocketsphinx/model/lm/en_US/cmu07a.dic"
wavfile = sys.argv[1]
speechRec = pocketsphinx.Decoder(hmm = hmdir, lm = lmdir, dict = dictd)
wavFile = file(wavfile,'rb')
speechRec.decode_raw(wavFile)
result = speechRec.get_hyp()
print result
This error means that python module tries to link to old pocketsphinx installed in your system in /usr/lib folder. You need to do the following:
1) Remove Ubuntu packages for sphinxbase and pocketsphinx
2) Configure linker to load libraries from /usr/local/lib folder (for example, set LD_LIBRARY_PATH or edit ld.so.conf).
Thanks, since I didn't use ubuntu packages, simple ldconfig get the error fixed.