pythonanacondapocketsphinx

How to use pocketsphinx with AnacondaPrompt


I installed pcketsphinx on Anaconda using conda-forge in this way.

conda install -c conda-forge pocketsphinx

And then I got the following message

Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - pocketsphinx

Current channels:

  - https://conda.anaconda.org/conda-forge/win-64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/win-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/win-64
  - https://repo.anaconda.com/pkgs/r/noarch
  - https://repo.anaconda.com/pkgs/msys2/win-64
  - https://repo.anaconda.com/pkgs/msys2/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

Why does it say "The following packages are not available from current channels:"?

How do I make pocketsphinx available to me?

I also tried pip install, but got an error.

    pip install pocketsphinx

  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\taichi\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\taichi\\AppData\\Local\\Temp\\pip-install-ha8v9dja\\pocketsphinx\\setup.py'"'"'; __file__='"'"'C:\\Users\\taichi\\AppData\\Local\\Temp\\pip-install-ha8v9dja\\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\taichi\AppData\Local\Temp\pip-wheel-2isplwue' --python-tag cp37
       cwd: C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\pocketsphinx\
  Complete output (6 lines):
  running bdist_wheel
  running build_ext
  building 'sphinxbase._sphinxbase' extension
  swigging deps/sphinxbase/swig/sphinxbase.i to deps/sphinxbase/swig/sphinxbase_wrap.c
  swig.exe -python -modern -threads -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o deps/sphinxbase/swig/sphinxbase_wrap.c deps/sphinxbase/swig/sphinxbase.i
  error: command 'swig.exe' failed: No such file or directory
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\taichi\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\taichi\\AppData\\Local\\Temp\\pip-install-ha8v9dja\\pocketsphinx\\setup.py'"'"'; __file__='"'"'C:\\Users\\taichi\\AppData\\Local\\Temp\\pip-install-ha8v9dja\\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\taichi\AppData\Local\Temp\pip-record-8osso05j\install-record.txt' --single-version-externally-managed --compile
         cwd: C:\Users\taichi\AppData\Local\Temp\pip-install-ha8v9dja\pocketsphinx\
    Complete output (6 lines):
    running install
    running build_ext
    building 'sphinxbase._sphinxbase' extension
    swigging deps/sphinxbase/swig/sphinxbase.i to deps/sphinxbase/swig/sphinxbase_wrap.c
    swig.exe -python -modern -threads -Ideps/sphinxbase/include -Ideps/sphinxbase/include/sphinxbase -Ideps/sphinxbase/include/win32 -Ideps/sphinxbase/swig -outdir sphinxbase -o deps/sphinxbase/swig/sphinxbase_wrap.c deps/sphinxbase/swig/sphinxbase.i
    error: command 'swig.exe' failed: No such file or directory
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\taichi\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\taichi\\AppData\\Local\\Temp\\pip-install-ha8v9dja\\pocketsphinx\\setup.py'"'"'; __file__='"'"'C:\\Users\\taichi\\AppData\\Local\\Temp\\pip-install-ha8v9dja\\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\taichi\AppData\Local\Temp\pip-record-8osso05j\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.

I'm using Anaconda3 and Python 3.7.4 and Windows 10 64bit.


Solution

  • I came across what looks like the same problem and was able to solve it with the following steps. Hopefully this will help you and others, at least to get started. Consider the following general points:

    1. Anaconda/Miniconda had a version of gcc that was picked up as the default compiler and, it seems, was interfering. Make sure gcc is picking up the desired compiler. To see what compilers you have, start up a terminal window, type gcc+TAB (gcc followed by a tab). This should show all the versions you have on your system. Type gcc --version to see which version is the default. And which gcc to find out where it is located, e.g. /Users/PatrickT/miniconda/bin/gcc
    2. You want to ensure that your system's PATH can find your compiler. This may be done by adding an export command to your bash profile. On Catalina, apparently, the bash profile information would be placed in .zshrc. To find this file, type COMMAND+SHIFT+E to make invisible files visible and look in your home directory (/Users/PatrickT in my case). For instance, add a line like export PATH="/usr/local/gcc-10/bin:$PATH". The path is of course dependent on your system.

    To make sure miniconda was not interfering, I took it off the PATH altogether. I also installed the latest version of xcode from the apple binaries. Once I had an updated version of the gcc compiler found by my system, I was able to install pocketsphinx as well as other programs that I was having problems with, like kaldi or zlib.

    Getting miniconda to work again without interfering with gcc is a problem I haven't solved. As soon as I put miniconda back on the PATH, the default gcc reverted to the miniconda version. To be continued...