csukuangfj / kaldifeat

Kaldi-compatible online & offline feature extraction with PyTorch, supporting CUDA, batch processing, chunk processing, and autograd - Provide C++ & Python API
https://csukuangfj.github.io/kaldifeat
Other
186 stars 35 forks source link

pip install kaldifeat error #93

Closed shanguanma closed 4 months ago

shanguanma commented 7 months ago

as the title says, I use pip install kaldifeat to install kaldifeat package, however, the error is as follows:

pip install kaldifeat
Collecting kaldifeat
  Downloading kaldifeat-1.24.tar.gz (467 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 467.9/467.9 kB 1.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: kaldifeat
  Building wheel for kaldifeat (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [142 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-38
      creating build/lib.linux-x86_64-cpython-38/kaldifeat
      copying kaldifeat/python/kaldifeat/__init__.py -> build/lib.linux-x86_64-cpython-38/kaldifeat
      copying kaldifeat/python/kaldifeat/fbank.py -> build/lib.linux-x86_64-cpython-38/kaldifeat
      copying kaldifeat/python/kaldifeat/mfcc.py -> build/lib.linux-x86_64-cpython-38/kaldifeat
      copying kaldifeat/python/kaldifeat/offline_feature.py -> build/lib.linux-x86_64-cpython-38/kaldifeat
      copying kaldifeat/python/kaldifeat/online_feature.py -> build/lib.linux-x86_64-cpython-38/kaldifeat
      copying kaldifeat/python/kaldifeat/plp.py -> build/lib.linux-x86_64-cpython-38/kaldifeat
      copying kaldifeat/python/kaldifeat/spectrogram.py -> build/lib.linux-x86_64-cpython-38/kaldifeat
      running build_ext
      Setting PYTHON_EXECUTABLE to /home/maduo/.conda/envs/icefall/bin/python
      For fast compilation, run:
      export KALDIFEAT_MAKE_ARGS="-j"; python setup.py install
      Setting make_args to '-j4'
      build command is:

                      cd build/temp.linux-x86_64-cpython-38

                      cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/home/maduo/.conda/envs/icefall/bin/python -Dkaldifeat_BUILD_TESTS=OFF  -DCMAKE_INSTALL_PREFIX=/tmp/pip-install-_jwmqwtg/kaldifeat_d5934231cb074573aa119dd076cd3bb4/build/lib.linux-x86_64-cpython-38/kaldifeat  /tmp/pip-install-_jwmqwtg/kaldifeat_d5934231cb074573aa119dd076cd3bb4

                      make  -j4  _kaldifeat install

      -- The C compiler identification is GNU 11.4.0
      -- The CXX compiler identification is GNU 11.4.0
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - skipped
      -- Detecting C compile features
      -- Detecting C compile features - done
      -- Detecting CXX compiler ABI info
      -- Detecting CXX compiler ABI info - done
      -- Check for working CXX compiler: /usr/bin/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- C++ Standard version: 14
      -- Downloading pybind11 from https://github.com/pybind/pybind11/archive/5bc0943ed96836f46489f53961f6c438d2935357.zip
      -- pybind11 is downloaded to /tmp/pip-install-_jwmqwtg/kaldifeat_d5934231cb074573aa119dd076cd3bb4/build/temp.linux-x86_64-cpython-38/_deps/pybind11-src
      CMake Deprecation Warning at build/temp.linux-x86_64-cpython-38/_deps/pybind11-src/CMakeLists.txt:8 (cmake_minimum_required):
        Compatibility with CMake < 3.5 will be removed from a future version of
        CMake.

        Update the VERSION argument <min> value or use a ...<max> suffix to tell
        CMake that the project does not need compatibility with older versions.

      -- pybind11 v2.11.0 dev1
      CMake Warning (dev) at build/temp.linux-x86_64-cpython-38/_deps/pybind11-src/tools/FindPythonLibsNew.cmake:98 (find_package):
        Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
        are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
        the cmake_policy command to set the policy and suppress this warning.

      Call Stack (most recent call first):
        build/temp.linux-x86_64-cpython-38/_deps/pybind11-src/tools/pybind11Tools.cmake:50 (find_package)
        build/temp.linux-x86_64-cpython-38/_deps/pybind11-src/tools/pybind11Common.cmake:180 (include)
        build/temp.linux-x86_64-cpython-38/_deps/pybind11-src/CMakeLists.txt:208 (include)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Found PythonInterp: /home/maduo/.conda/envs/icefall/bin/python (found suitable version "3.8.18", minimum required is "3.6")
      -- Found PythonLibs: /home/maduo/.conda/envs/icefall/lib/libpython3.8.so
      -- Performing Test HAS_FLTO
      -- Performing Test HAS_FLTO - Success
      -- Python executable: /home/maduo/.conda/envs/icefall/bin/python
      -- TORCH_DIR: /home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/torch
      -- Found CUDA: /home/maduo/installed/cuda-11.8.0 (found version "11.8")
      -- The CUDA compiler identification is NVIDIA 11.8.89
      -- Detecting CUDA compiler ABI info
      -- Detecting CUDA compiler ABI info - done
      -- Check for working CUDA compiler: /home/maduo/installed/cuda-11.8.0/bin/nvcc - skipped
      -- Detecting CUDA compile features
      -- Detecting CUDA compile features - done
      -- Unable to find cuda_runtime.h in "/home/maduo/installed/cuda-11.8.0/include" for CUDAToolkit_INCLUDE_DIR.
      -- Unable to find cublas_v2.h in either "" or "/home/maduo/math_libs/include"
      CMake Error at /home/maduo/installed/cmake-2.28.0/cmake-3.28.0-linux-x86_64/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
        Could NOT find CUDAToolkit (missing: CUDAToolkit_INCLUDE_DIR) (found
        version "11.8.89")
      Call Stack (most recent call first):
        /home/maduo/installed/cmake-2.28.0/cmake-3.28.0-linux-x86_64/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
        /home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/torch/share/cmake/Caffe2/FindCUDAToolkit.cmake:837 (find_package_handle_standard_args)
        /home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:59 (find_package)
        /home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:87 (include)
        /home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/torch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
        cmake/torch.cmake:14 (find_package)
        CMakeLists.txt:59 (include)

      -- Configuring incomplete, errors occurred!
      make: *** No rule to make target '_kaldifeat'.  Stop.
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-_jwmqwtg/kaldifeat_d5934231cb074573aa119dd076cd3bb4/setup.py", line 32, in <module>
          setuptools.setup(
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/wheel/bdist_wheel.py", line 364, in run
          self.run_command("build")
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/dist.py", line 989, in run_command
          super().run_command(command)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/command/build_ext.py", line 88, in run
          _build_ext.run(self)
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/home/maduo/.conda/envs/icefall/lib/python3.8/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "/tmp/pip-install-_jwmqwtg/kaldifeat_d5934231cb074573aa119dd076cd3bb4/cmake/cmake_extension.py", line 124, in build_extension
          raise Exception(
      Exception:
      Build kaldifeat failed. Please check the error message.
      You can ask for help by creating an issue on GitHub.

      Click:
          https://github.com/csukuangfj/kaldifeat/issues/new

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for kaldifeat
  Running setup.py clean for kaldifeat
Failed to build kaldifeat

the cuda environment is as follows:

export CUDA_HOME=/home/maduo/installed/cuda-11.8.0
export PATH=$CUDA_HOME/bin:$PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib64:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$CUDA_HOME/lib:$LD_LIBRARY_PATH
export CUDA_TOOLKIT_ROOT_DIR=$CUDA_HOME
export CUDA_TOOLKIT_ROOT=$CUDA_HOME
export CUDAToolkit_INCLUDE_DIR=$CUDA_HOME/include

export CUDAToolkit_ROOT_DIR=$CUDA_HOME
export CUDAToolkit_ROOT=$CUDA_HOME

export CUDA_BIN_PATH=$CUDA_HOME
export CUDA_PATH=$CUDA_HOME
export CUDA_INC_PATH=$CUDA_HOME/targets/x86_64-linux
export CFLAGS=-I$CUDA_HOME/targets/x86_64-linux/include:$CFLAGS

I think that cmake could not find CUDA toolkit variable, but I can not find the CMakeLists.txt in the source of github , How to do it ?

csukuangfj commented 7 months ago

Could you try the installation method in https://csukuangfj.github.io/kaldifeat/installation/index.html

csukuangfj commented 7 months ago

If you want to fix it, please tell us how you installed cudatoolkit.

shanguanma commented 7 months ago

If you want to fix it, please tell us how you installed cudatoolkit.

I follow your suggestion to install cuda and cudnn via https://k2-fsa.github.io/k2/installation/cuda-cudnn.html