Installing pocketsphinx python module: command 'swig.exe' failed

pip install pocketsphinx error
how to install pocketsphinx-python
pocketsphinx-python raspberry pi
no module named 'pocketsphinx'
pocketsphinx documentation
pip install swig
speech recognition python
cmu sphinx pip

I'm getting something like this. Can anyone please tell me how to fix this.

C:\Users\krush\Documents\ML using Python>pip install pocketsphinx
Collecting pocketsphinx
  Using cached pocketsphinx-0.1.3.zip
Building wheels for collected packages: pocketsphinx
  Running setup.py bdist_wheel for pocketsphinx: started
  Running setup.py bdist_wheel for pocketsphinx: finished with status 'error'
  Complete output from command C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\krush\AppData\Local\Temp\tmp3tyvnl9wpip-wheel- --python-tag cp36:
  running bdist_wheel
  running build_ext
  building 'sphinxbase._ad' extension
  swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
  swig.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
  error: command 'swig.exe' failed: No such file or directory

  ----------------------------------------
  Failed building wheel for pocketsphinx
  Running setup.py clean for pocketsphinx
Failed to build pocketsphinx
Installing collected packages: pocketsphinx
  Running setup.py install for pocketsphinx: started
    Running setup.py install for pocketsphinx: finished with status 'error'
    Complete output from command C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\krush\AppData\Local\Temp\pip-x5mxeczy-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build_ext
    building 'sphinxbase._ad' extension
    swigging swig/sphinxbase/ad.i to swig/sphinxbase/ad_wrap.c
    swig.exe -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
    error: command 'swig.exe' failed: No such file or directory

    ----------------------------------------
Command "C:\Users\krush\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\krush\\AppData\\Local\\Temp\\pip-build-cns2i_wb\\pocketsphinx\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\krush\AppData\Local\Temp\pip-x5mxeczy-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\krush\AppData\Local\Temp\pip-build-cns2i_wb\pocketsphinx\

To fix the problem, I downloaded swig for windows

  1. Copy swig.exe to the python installation folder (for ex C:/python27)

  2. Open swigwin-3.0.12/Lib folder and copy all *.swg files to the C:/python27/lib or equivalent python path

  3. Open swigwin-3.0.12/lib/python and copy all the files to (C:/python27/lib)

(Also make sure you have Microsoft Visual C++ Compiler for Python installed)

These steps worked for me.

pocketsphinx · PyPI, Python interface to CMU Sphinxbase and Pocketsphinx libraries. More binary distributions for manual installation are available here. from pocketsphinx import LiveSpeech speech = LiveSpeech(lm=False, keyphrase='forward',  Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'pocketsphinx' If you are window user run the following command on Command Prompt python -m pip install --upgrade pip setuptools wheel


You try to install pocketsphinx with pip, that will download and compile this module. It requires some compiling tool like swig.

Another solution is to install a binary version of pocketsphinx. You can download a binary version here. You have to select the correct version with respect to your installation.

To determine which one you have to download, you can run the following commands, that will tell you which version you require and whether you run a 32 or 64 bit python interpreter.

"C:\Users\krush\Anaconda3\python.exe" --version
"C:\Users\krush\Anaconda3\python.exe" -c "import struct;print(struct.calcsize('P') * 8)"

Below are some commands that you may enter once you have downloaded the correct version

"C:\Users\krush\Anaconda3\python.exe" -m pip install pocketsphinx‑0.1.3‑cp35‑cp35m‑win32.whl
"C:\Users\krush\Anaconda3\python.exe" -m pip install pocketsphinx‑0.1.3‑cp36‑cp36m‑win_amd64.whl

HOW TO INSTALL POCKETSPHINX PYTHON, Inscreva-se: https://goo.gl/G4Ppnf ****** Descrição: In this video I'm going to show you how to Duration: 6:23 Posted: 20 Oct 2017 from pocketsphinx import Pocketsphinx ps = Pocketsphinx (verbose = True) ps. decode print (ps. hypothesis ()) Send output to file: from pocketsphinx import Pocketsphinx ps = Pocketsphinx ( verbose = True , logfn = 'pocketsphinx.log' ) ps . decode () print ( ps . hypothesis ())


Instead of copying Swig files to the Python folder, you can simply add Swig`s location to the environment variables:

  1. Press Ctrl+S
  2. Type env and press Enter
  3. Double click on Path
  4. Add the path-to-Swig to the last blank line
  5. Click OK and restart your PC

Installing pocketsphinx python module: command 'swig.exe' failed, Installing pocketsphinx python module: command 'swig.exe' failed. pip install pocketsphinx error pocketsphinx-python raspberry pi install pocketsphinx ubuntu installed, open the Command Prompt(⊞Win-rand type cmd). Once the command prompt is open, type python --versionand press Enter. If Python is installed, you will see the version of Python printed to the screen. If you do not have Python installed, refer to the Hitchhikers Guide to Python’sPython on Windows installation guides. You must install


conda install swig
pip install pocketsphinx

I didn't want to do all that setup other people are suggesting so I tried this and it worked. This probably only works if you are using Anaconada though.

Building an application with PocketSphinx – CMUSphinx Open , PocketSphinx is a library that depends on another library called SphinxBase You can also set an installation prefix with --prefix or configure to use or not to use SWIG Python on the command line and make sure the output looks like this:. To build pocketsphinx in a Unix-like environment (such as Linux, Solaris, FreeBSD etc.) you need to make sure you have the following dependencies installed: gcc, automake, autoconf, libtool, bison, swig (at least version 2.0), the Python development package and the pulseaudio development package.


I was also getting same error, while installing in ubuntu 16.04, I executed following commands:

sudo apt-get install -y python python-dev python-pip build-essential swig git libpulse-dev

sudo pip install pocketsphinx

source: pocketsphinx-python

Error installing python module pocketsphinx, Running setup.py bdist_wheel for pocketsphinx error. Complete output from command /usr/bin/python -u -c "import setuptools, tokenize  sudo apt-get install -y python python-dev python-pip build-essential swig git sudo pip install pocketsphinx For the second: That’s the same issue you had previously right?


[PDF] sphinxwrapper Documentation, You can read more about the CMU Sphinx speech recognition projects here. Either of the above commands will also install the required pocketsphinx-python package. The usage from sphinxwrapper import PocketSphinx. Failed building wheel for pocketsphinx Running setup.py clean for pocketsphinx Failed to build pocketsphinx Installing collected packages: python-pptx, beautifulsoup4, six, EbookLib, chardet, docx2txt, xlrd, argcomplete, pocketsphinx, SpeechRecognition, textract


pip install failed · Issue #16 · cmusphinx/pocketsphinx-python · GitHub, returns me error: Command "/usr/bin/python -u -c "import setuptools, tokenize;file​='/private/tmp/pip-build-flT_f6/pocketsphinx/setup.py'  PocketSphinx-Python wheel packagesfor 64-bit Python 2.7, 3.4, and 3.5 on Windows are included for convenience, under the third-party/directory. To install, simply run pip install wheelfollowed by pip install./third-party/WHEEL_FILENAME(replace pipwith pip3if using Python 3) in the SpeechRecognition folder.


cmusphinx/pocketsphinx-python: Python module installed , Python module installed with setup.py. Contribute to cmusphinx/pocketsphinx-​python development by creating an account on GitHub. Installing Python Modules¶ Email. distutils-sig @ python. org. As a popular open source development project, Python has an active supporting community of contributors and users that also make their software available for other Python developers to use under open source license terms.