I encounter the following error on importing pocketsphinx python module
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "sphinxbase.pxd", line 138, in init pocketsphinx (pocketsphinx.c:6695)
ValueError: PyCapsule_GetPointer called with invalid PyCapsule object
But when I import pocketsphinx module once again in the same instance of Python interpreter, it works.
I am getting a similar problem
[myUser@sv-astrisk python]$ ipython
WARNING: Readline services not available or not loaded.WARNING: The auto-indent feature requires the readline libraryPython 2.7 (r27:82500, Mar 7 2012, 22:44:05)
Type "copyright", "credits" or "license" for more information.
IPython 0.12.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import sphinxbase
In [2]: import pocketsphinx
ValueError Traceback (most recent call last)
/home/myUser/downloads/sphinx/sphinxbase-0.7/python/<ipython-input-2-fd763eca10d8> in <module>()
----> 1 import pocketsphinx
/home/myUser/.python-eggs/PocketSphinx-0.7-py2.7-linux-i686.egg-tmp/pocketsphinx.so in <module>()
/home/myUser/.python-eggs/PocketSphinx-0.7-py2.7-linux-i686.egg-tmp/pocketsphinx.so in bootstrap()
/home/myUser/.python-eggs/PocketSphinx-0.7-py2.7-linux-i686.egg-tmp/pocketsphinx.so in init pocketsphinx (pocketsphinx.c:6844)()
ValueError: PyCapsule_GetPointer called with invalid PyCapsule object
In [3]:
I would be happy to help troubleshoot this, please let me know if I can supply any other information.
This error occured for me when running python 2.7.3
I installed python 2.6.8, recompiled sphinx base 0.7 and pocketsphinx 0.7 (make clean first) and ./configure --with-python=/path/to/python2.6/bin/python
This seems to have fixed the problem for the time being.
This is unlikely a pocketsphinx problem. Something got broken on python or cython. If you want to help go to cython developers and ask them what is going on.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Issues"
The C source files emitted by Cython need to be regenerated and then sphinxbase and pocketsphinx need to be rebuilt to correct the exception on import.
Delete 'python/sphinxbase.c' from the sphinxbase source directory and delete 'python/pocketsphinx.c' from the pocketsphinx source directory. Make sure Cython is installed so these files can be regenerated.
Next, just ./configure, make clean all, and make install as outlined in each README. Your version of Cython will be invoked to regenerate the files you deleted.
Last edit: Anonymous 2016-09-27
Thanks, Anonymous. I was experiencing this issue and your solution worked for me! :)
Last edit: Jose Rodriguez 2013-03-11
Also don't forget that if you ran
prior to removing the files as stated above, you will have to run that again after recompiling.
I encountered a similar problem (Windows 7 64-bit, Python 2.7.3 32-bit).
Following the steps proposed by Anonymous, import ok now.
However, just like
https://sourceforge.net/p/cmusphinx/discussion/help/thread/ddb855bc/#ed45
when trying to decode_raw(), Python crashed without any info.
What could be the possible reason?
BTW, this is the first time I compile a python package from source. Are there pre-compiled binaries for the python binding of pocketsphinx in Windows?
Thanks for any information.
Last edit: heinrich tsien 2013-04-15
Sphinxbase and Pocketsphinx are now using SWIG instead of Cython. So this bug is not relevant anymore.
@Anonymous
I am having the same PyCapsule error when importing pocketsphinx on windows. I have Python 2.7.3, Windows 7 32 Bit and I have installed sphinxbase 0.8 and pocketsphinx 0.8 using Visual Studio 2010 and there were no errors during the compilation of the source.
Regarding the regeneration of C source using Cython, how am I supposed to that on Windows?
Hello, I tried what Anonymous described in https://sourceforge.net/p/cmusphinx/bugs/284/#b6ea
But I am still getting the same error. I am using Mac OSX 10.9.2
Hello William
The fix will be available in the next release. If you want to access it now, you need to checkout development version from subversion or download a snapshot from github:
http://github.com/cmusphinx