pythonpython-3.xswigcmusphinxpocketsphinx

PocketSphinx install can't find swig.exe


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!


Solution

  • 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.