Search code examples
pythonpython-2.7gstreamercmusphinxpocketsphinx

ImportError: cannot import name pygtkcompat


I'm trying to run a program that tests pocketsphinx's ability to recognize audio in real time (code taken from here), but I'm getting an ImportError every time it tries to import pygtkcompat from gi

from gi import pygtkcompat

Any ideas on how to fix this?


Solution

  • I solved the issue. The problem was because gi wasn't installed correctly and was in the wrong path. I removed and re-installed it a few times, but I must have been doing it wrong somehow because it took a few retries before it started working again. The cause must have been using "sudo apt-get install python-gi" instead of pip (as sudo).