parlance/ctcdecode

PIP INSTALLATION STILL FAIL

NoCodeAvaible opened this issue · 2 comments

Hey dear contributors,
the pip installation still fails to install ctcdecode on windows.
I've tried to do:
git clone --recursive https://github.com/parlance/ctcdecode.git
cd ctcdecode && pip install .

but nothing seems to work.
This is the error being raiced while trying to install the module:

Building wheels for collected packages: ctcdecode
  Building wheel for ctcdecode (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: 'C:\Users\supre\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\supre\\AppData\\Local\\Temp\\pip-req-build-qj51rq8f\\setup.py'"'"'; __file__='"'"'C:\\Users\\supre\\AppData\\Local\\Temp\\pip-req-build-qj51rq8f\\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\supre\AppData\Local\Temp\pip-wheel-sr3gd52g'
       cwd: C:\Users\supre\AppData\Local\Temp\pip-req-build-qj51rq8f\
  Complete output (20 lines):
  No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0'
  C:\Users\supre\anaconda3\lib\distutils\extension.py:131: UserWarning: Unknown Extension options: 'package', 'with_cuda'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build\lib.win-amd64-3.8
  creating build\lib.win-amd64-3.8\ctcdecode
  copying ctcdecode\__init__.py -> build\lib.win-amd64-3.8\ctcdecode
  running build_ext
  C:\Users\supre\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden
    warnings.warn(f'Error checking compiler version for {compiler}: {error}')
  building 'ctcdecode._ext.ctc_decode' extension
  error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
  Error in atexit._run_exitfuncs:
  Traceback (most recent call last):
    File "C:\Users\supre\anaconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
      return stream.closed
  ValueError: underlying buffer has been detached
  ----------------------------------------
  ERROR: Failed building wheel for ctcdecode
  Running setup.py clean for ctcdecode
Failed to build ctcdecode
Installing collected packages: ctcdecode
    Running setup.py install for ctcdecode ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\supre\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\supre\\AppData\\Local\\Temp\\pip-req-build-qj51rq8f\\setup.py'"'"'; __file__='"'"'C:\\Users\\supre\\AppData\\Local\\Temp\\pip-req-build-qj51rq8f\\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\supre\AppData\Local\Temp\pip-record-po3wgzez\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\supre\anaconda3\Include\ctcdecode'
         cwd: C:\Users\supre\AppData\Local\Temp\pip-req-build-qj51rq8f\
    Complete output (20 lines):
    No CUDA runtime is found, using CUDA_HOME='C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0'
    C:\Users\supre\anaconda3\lib\distutils\extension.py:131: UserWarning: Unknown Extension options: 'package', 'with_cuda'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.8
    creating build\lib.win-amd64-3.8\ctcdecode
    copying ctcdecode\__init__.py -> build\lib.win-amd64-3.8\ctcdecode
    running build_ext
    C:\Users\supre\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:304: UserWarning: Error checking compiler version for cl: [WinError 2] Das System kann die angegebene Datei nicht finden
      warnings.warn(f'Error checking compiler version for {compiler}: {error}')
    building 'ctcdecode._ext.ctc_decode' extension
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    Error in atexit._run_exitfuncs:
    Traceback (most recent call last):
      File "C:\Users\supre\anaconda3\lib\site-packages\colorama\ansitowin32.py", line 59, in closed
        return stream.closed
    ValueError: underlying buffer has been detached
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\supre\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\supre\\AppData\\Local\\Temp\\pip-req-build-qj51rq8f\\setup.py'"'"'; __file__='"'"'C:\\Users\\supre\\AppData\\Local\\Temp\\pip-req-build-qj51rq8f\\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\supre\AppData\Local\Temp\pip-record-po3wgzez\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\supre\anaconda3\Include\ctcdecode' Check the logs for full command output.

It would be very very nice if this could be fixed.
Thank's for every help in advance;)

hello all,

after spending a certain amount of time i found the problem. in my case, the development packages of python (python-dev and python3-dev) were not installed. after installing them on Ubuntu-18.04 using: sudo apt install python-dev && sudo apt install python3-dev, i was able to install ctcdecode without a problem.

however, this may not be the exact case for you so i recommend you to check whether you have the following packages/libraries (also giving the versions i am using):

  1. essential packages for building debian packages: sudo apt install build-essential
  2. torch==1.9.0
  3. gcc and g++ version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

hope these help!

Same problem here on MB Pro M1, I tried to pip install . but didn't work even after many times trying to install the third_party dependencies (Boost, OpenFst) with several different versions. I think the problem was on the g++ compiler. Any idea to resolve this?