9

I am having this problem while installing pocketsphinx in python3

I'm using anaconda3, windows 10 .

pip install --upgrade pocketsphinx

Below is the error which I got while installing pocketsphinx.

Collecting pocketsphinx
     Using cached pocketsphinx-0.1.3.zip
     Building wheels for collected packages: pocketsphinx
     Running setup.py bdist_wheel for pocketsphinx ... error
     Complete output from command /home/geek/anaconda3/bin/python -u -c                                              
     "import setuptools, tokenize;__file__='/tmp/pip-build-k634wg4p  
     /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  
      /tmp/tmp6ts477xjpip-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 -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include  
    /sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig-   
     outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i

     unable to execute 'swig': No such file or directory
      error: command 'swig' failed with exit status 1

 ----------------------------------------
 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 ... error
 Complete output from command /home/geek/anaconda3/bin/python -u -c  
 "import    
 setuptools, tokenize;__file__='/tmp/pip-build-k634wg4p/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 
/tmp/pip-q7w8xgtz-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 -python -modern -Ideps/sphinxbase/include -Ideps/sphinxbase/include
/sphinxbase -Ideps/sphinxbase/include/android -Ideps/sphinxbase/swig  
 -outdir sphinxbase -o swig/sphinxbase/ad_wrap.c swig/sphinxbase/ad.i
 unable to execute 'swig': No such file or directory
error: command 'swig' failed with exit status 1

Please help me to get out of this.

  • **Google Colab** users might want to look [this](https://stackoverflow.com/a/54124548/5320982) answer. Also windows users do see check the link for further requirements of installing `pocketsphinx`. – Rex5 Jun 27 '19 at 08:50

4 Answers4

13

Try this command:

sudo apt-get install swig

It installs swig, which is one of the requirements of pocketsphinx.

Fabián Montero
  • 1,613
  • 1
  • 16
  • 34
rajendra gurjar
  • 131
  • 1
  • 4
  • [How to write an answer](https://stackoverflow.com/help/how-to-answer) Add more details to justify your answer. – Morse Mar 27 '18 at 14:22
  • OP specifies that his OS is Win 10, apt-get does not seem to be a way to go – sukhmel May 19 '20 at 09:42
5

If you are on MacOSX then, try this command.

brew install swig
Nadun Kulatunge
  • 1,567
  • 2
  • 20
  • 28
3

Do you have Swig installed?

I had this same problem, and saw on the PocketSphinx index at PyPI that one of the requirements is Swig, which can be downloaded at http://www.swig.org/download.html (hosted at SourceForge) and installed from source using the ./configure && make && make install combo.
I then proceeded to install PocketSphinx from source, but it seems the problem was the same, so you could try to use pip still.

1

Try this:

pip install pipwin
pipwin install pocketsphinx
Elletlar
  • 3,136
  • 7
  • 32
  • 38