Pocketsphinx : Unable to install on Python 3.6.

Pocketsphinx is a Python interface to CMU Sphinxbase and Pocketsphinx libraries and it’s a dependencie of SpeechRecognition. I find an issue when I try to install on my Python 3.6 environment.

python3 -m pip install –upgrade PocketSphinx
Collecting PocketSphinx
Using cached pocketsphinx-0.1.3.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “<string>”, line 1, in <module>
File “/tmp/pip-build-kigjo2sc/PocketSphinx/setup.py”, line 189, in <module>
File “/usr/lib/python3.6/encodings/ascii.py”, line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xd0 in position 7287: ordinal not in range(128)

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-kigjo2sc/PocketSphinx/


I’ts very simple to solve it. Follow this few steps.

  • Clone the pocketsphinx repository : git clone –recursive https://github.com/bambocher/pocketsphinx-python.
  • Got to the directory : cd ./pocketsphinx-python/.
  • Edit ./setup.py and replace the line 189 with long_description=open(‘README.rst’, encoding=”utf-8″).read(),
  • Build to control : python3.6 ./setup.py build.
  • Install : python3.6 -m pip install -e .

Now you can play with this tool.


Leave a Reply

Your email address will not be published. Required fields are marked *