2

I have searched all over the web and especially have gone through all the questions regarding this here on Stackoverflow.

I am using the following command to install it "pip install pocketsphinx"

I have windows x64, I have not set any environmental paths regarding Swig.

Also I've downloaded Swig zip file and extracted it into my downloads folder, searched through it and there is no "swig.exe" file.

Below you can see the error/log from the command prompt.

C:\Users\User>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 ... error
  Complete output from command c:\users\user\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\User\\AppData\\Local\\Temp\\pip-build-i770rcof\\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\User\AppData\Local\Temp\tmpgkhbp3u1pip-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 ... error
    Complete output from command c:\users\user\appdata\local\programs\python\python36\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\User\\AppData\\Local\\Temp\\pip-build-i770rcof\\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\User\AppData\Local\Temp\pip-s5wxsxzb-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

Any assistance is highly appreciated, thanks in advance!

John Smith
  • 851
  • 2
  • 10
  • 22
  • Possible duplicate of [Swig not found when installing pocketsphinx Python](https://stackoverflow.com/questions/33745389/swig-not-found-when-installing-pocketsphinx-python) – Nikolay Shmyrev Jan 13 '18 at 08:48
  • This lacks detail and I have no idea how that would make it detectable. I may be close to a solution and will update when and if it works. – John Smith Jan 13 '18 at 13:09

3 Answers3

4

Alright, I solved it. Here’s how:

First I went to their official website and downloaded the swigwin file specifically for windows with a “swig.exe” file.

Then I extracted it, and added it to the environment variable PATH. This solved my problem.

Afterwards I got another error, it couldn’t find visual studio C++ build tools v14.0 (along these lines), if you have this problem too just, download the C++ build tools 2015 from their official website, install, then find it in your Program Files or what ever, copy the path to the VC folder and add it to your environment variable PATH as well.

This allowed me to download/install pocketsphinx on windows.

John Smith
  • 851
  • 2
  • 10
  • 22
3

First run your IDE or CMD as Administrator and run the following:

pip install pipwin
pipwin install pocketsphinx
zak
  • 50
  • 5
1

If you just want to install pocketsphinx on windows, then you can install binary of pocketsphinx. The binaries suited to your system can be found here

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pocketsphinx

Chose right binary for your system and then you can install it using following command

python -m pip install pocketsphinx‑downloaded_wheel.whl

Rao Sahab
  • 1,161
  • 1
  • 10
  • 12