k2-fsa / sherpa

Speech-to-text server framework with next-gen Kaldi
https://k2-fsa.github.io/sherpa
Apache License 2.0
483 stars 97 forks source link

Issue when Installing Kaldifeat on Windows 11 #440

Closed Caet-pip closed 11 months ago

Caet-pip commented 12 months ago

Hello I get errors when trying to install Kaldifeat these are the logs

python setup.py install running install C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( running bdist_egg running egg_info creating kaldifeat.egg-info writing kaldifeat.egg-info\PKG-INFO writing dependency_links to kaldifeat.egg-info\dependency_links.txt writing top-level names to kaldifeat.egg-info\top_level.txt writing manifest file 'kaldifeat.egg-info\SOURCES.txt' reading manifest file 'kaldifeat.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' writing manifest file 'kaldifeat.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py creating build creating build\lib.win-amd64-cpython-310 creating build\lib.win-amd64-cpython-310\kaldifeat copying kaldifeat\python\kaldifeat\fbank.py -> build\lib.win-amd64-cpython-310\kaldifeat copying kaldifeat\python\kaldifeat\mfcc.py -> build\lib.win-amd64-cpython-310\kaldifeat copying kaldifeat\python\kaldifeat\offline_feature.py -> build\lib.win-amd64-cpython-310\kaldifeat copying kaldifeat\python\kaldifeat\online_feature.py -> build\lib.win-amd64-cpython-310\kaldifeat copying kaldifeat\python\kaldifeat\plp.py -> build\lib.win-amd64-cpython-310\kaldifeat copying kaldifeat\python\kaldifeat\spectrogram.py -> build\lib.win-amd64-cpython-310\kaldifeat copying kaldifeat\python\kaldifeat__init__.py -> build\lib.win-amd64-cpython-310\kaldifeat running build_ext Setting PYTHON_EXECUTABLE to C:\ProgramData\anaconda3\python.exe build command is:

            cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=C:\ProgramData\anaconda3\python.exe -Dkaldifeat_BUILD_TESTS=OFF  -DCMAKE_INSTALL_PREFIX=C:\Users\Fawaz Shaik\sherpao\kaldifeat\build\lib.win-amd64-cpython-310/kaldifeat  -B build\temp.win-amd64-cpython-310\Release -S C:\Users\Fawaz Shaik\sherpao\kaldifeat
            cmake --build build\temp.win-amd64-cpython-310\Release --target _kaldifeat --config Release -- -m
            cmake --build build\temp.win-amd64-cpython-310\Release --target install --config Release -- -m

CMake Error: The source directory "C:/Users/Fawaz Shaik/sherpao/kaldifeat/Shaik/sherpao/kaldifeat" does not exist. Specify --help for usage, or press the help button on the CMake GUI. Traceback (most recent call last): File "C:\Users\Fawaz Shaik\sherpao\kaldifeat\setup.py", line 32, in setuptools.setup( File "C:\ProgramData\anaconda3\lib\site-packages\setuptools__init__.py", line 87, in setup return distutils.core.setup(**attrs) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\dist.py", line 969, in run_commands self.run_command(cmd) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\dist.py", line 1208, in run_command super().run_command(command) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\install.py", line 74, in run self.do_egg_install() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\install.py", line 123, in do_egg_install self.run_command('bdist_egg') File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\dist.py", line 1208, in run_command super().run_command(command) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\bdist_egg.py", line 165, in run cmd = self.call_command('install_lib', warn_dir=0) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\bdist_egg.py", line 151, in call_command self.run_command(cmdname) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\dist.py", line 1208, in run_command super().run_command(command) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\install_lib.py", line 11, in run self.build() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\command\install_lib.py", line 112, in build self.run_command('build_ext') File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\cmd.py", line 318, in run_command self.distribution.run_command(command) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\dist.py", line 1208, in run_command super().run_command(command) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\dist.py", line 988, in run_command cmd_obj.run() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 84, in run _build_ext.run(self) File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\command\build_ext.py", line 346, in run self.build_extensions() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\command\build_ext.py", line 468, in build_extensions self._build_extensions_serial() File "C:\ProgramData\anaconda3\lib\site-packages\setuptools_distutils\command\build_ext.py", line 494, in _build_extensions_serial self.build_extension(ext) File "C:\Users\Fawaz Shaik\sherpao\kaldifeat\cmake\cmake_extension.py", line 90, in build_extension raise Exception("Failed to configure kaldifeat") Exception: Failed to configure kaldifeat

csukuangfj commented 12 months ago

What if you switch to a directory that doesn't contain a space?

Your user name contains a space.

Caet-pip commented 12 months ago

I tried in another direcory with no space, I get this error

python setup.py install running install C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools. warnings.warn( C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools. warnings.warn( running bdist_egg running egg_info writing kaldifeat.egg-info\PKG-INFO writing dependency_links to kaldifeat.egg-info\dependency_links.txt writing top-level names to kaldifeat.egg-info\top_level.txt reading manifest file 'kaldifeat.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' adding license file 'LICENSE' writing manifest file 'kaldifeat.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py copying kaldifeat\python\kaldifeat__init__.py -> build\lib.win-amd64-cpython-311\kaldifeat running build_ext Setting PYTHON_EXECUTABLE to C:\Users\Flanx\sherpa\Scripts\python.exe build command is:

            cmake -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=C:\Users\Flanx\sherpa\Scripts\python.exe -Dkaldifeat_BUILD_TESTS=OFF  -DCMAKE_INSTALL_PREFIX=C:\Users\Flanx\kaldifeat\build\lib.win-amd64-cpython-311/kaldifeat  -B build\temp.win-amd64-cpython-311\Release -S C:\Users\Flanx\kaldifeat
            cmake --build build\temp.win-amd64-cpython-311\Release --target _kaldifeat --config Release -- -m
            cmake --build build\temp.win-amd64-cpython-311\Release --target install --config Release -- -m

-- Building for: NMake Makefiles CMake Error at CMakeLists.txt:5 (project): Running

'nmake' '-?'

failed with:

The system cannot find the file specified

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage -- Configuring incomplete, errors occurred! Traceback (most recent call last): File "C:\Users\Flanx\kaldifeat\setup.py", line 32, in setuptools.setup( File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools__init__.py", line 87, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\core.py", line 201, in run_commands dist.run_commands() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\dist.py", line 968, in run_commands self.run_command(cmd) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\dist.py", line 1217, in run_command super().run_command(command) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command cmd_obj.run() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\install.py", line 74, in run self.do_egg_install() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\install.py", line 123, in do_egg_install self.run_command('bdist_egg') File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\cmd.py", line 319, in run_command self.distribution.run_command(command) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\dist.py", line 1217, in run_command super().run_command(command) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command cmd_obj.run() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\bdist_egg.py", line 165, in run cmd = self.call_command('install_lib', warn_dir=0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\bdist_egg.py", line 151, in call_command self.run_command(cmdname) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\cmd.py", line 319, in run_command self.distribution.run_command(command) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\dist.py", line 1217, in run_command super().run_command(command) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command cmd_obj.run() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\install_lib.py", line 11, in run self.build() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\command\install_lib.py", line 112, in build self.run_command('build_ext') File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\cmd.py", line 319, in run_command self.distribution.run_command(command) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\dist.py", line 1217, in run_command super().run_command(command) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\dist.py", line 987, in run_command cmd_obj.run() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run _build_ext.run(self) File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 346, in run self.build_extensions() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 466, in build_extensions self._build_extensions_serial() File "C:\Users\Flanx\sherpa\Lib\site-packages\setuptools_distutils\command\build_ext.py", line 492, in _build_extensions_serial self.build_extension(ext) File "C:\Users\Flanx\kaldifeat\cmake\cmake_extension.py", line 90, in build_extension raise Exception("Failed to configure kaldifeat") Exception: Failed to configure kaldifeat

Caet-pip commented 12 months ago

I have installed latest version of Pytorch and k2

csukuangfj commented 12 months ago

Please install visual studio to compile kaldifeat from source. Or please wait for a day or two before I manage to provide pre-compiled wheels for kaldifeat.

Caet-pip commented 12 months ago

I can try compiling Kaldifeat from source by using Visual Studio, I need to try this in the Command Line of Visual Studio for this right?

And thanks for providing pre-compiled wheels, I will be sure to try using that once it is out.

csukuangfj commented 12 months ago

We have a video demostrating how to install visual studio on Windows. Maybe it is helpful. https://k2-fsa.github.io/sherpa/ncnn/install/videos.html

I need to try this in the Command Line of Visual Studio for this right?

Yes, you are right. The developer command prompt of visual studio.

Caet-pip commented 12 months ago

This is ncnn right? I am trying to install the Python model on Windows. I was able to download the ONNX models perfectly without issue but need the Python model to so that I can extract the text and run analysis as I use Python and not C++.

If there is any demo on installing the Python model please let me know.

Also If there is any demo on the Client Server Build that would be very useful as I am trying to figure this out in ONNX Websocket example from the documentation. I am new to this so facing trouble. Your guidance will be very helpful thank you!

csukuangfj commented 12 months ago

The way to install visual studio is not specific for sherpa-ncnn.

It is general.

csukuangfj commented 12 months ago

If you want to use onnx models, then I recommend sherpa-onnx.

What you need is to run

pip install sherpa-onnx

You don't need to install visual studio in this case.

Caet-pip commented 12 months ago

I am sorry if I was not clear previously.

I want to run Sherpa with Python and am trying to install Kaldifeat to run that, I have already instaled sherpa-ONNX but as I do not know C++ and I know Python I want to download the Python implementation.

Any guidance on installing the Python Implementation will be useful. I am trying to install Kaldifeat now in VS Terminal

csukuangfj commented 12 months ago

How did you install sherpa-onnx?

k2-fsa/sherpa does not work with onnx models, only k2-fsa/sherpa-onnx does.

pip install sherpa-onnx installs the python stuff for you.

Caet-pip commented 12 months ago

I followed instructions on https://k2-fsa.github.io/sherpa/onnx/install/windows.html#bit-windows-x64 to install sherpa-onnx

As per my understanding the inferencing here is done using the ./build/bin/Release/sherpa-onnx-microphone which is a .exe file. I wanted to do inferencing with Python files so I can understand the code.

For this I am trying to install Sherpa in Python implementation, can you guide me on this

csukuangfj commented 12 months ago

For this I am trying to install Sherpa in Python implementation, can you guide me on this

As I have said twice, you only need to run

pip install sherpa-onnx
Caet-pip commented 12 months ago

Yes, but i want to use Sherpa in my python files for inferencing as I want to extract the output. Is there any example of this after installing it with pip

csukuangfj commented 12 months ago

Yes, we have detailed documentation.

Please have a look at https://k2-fsa.github.io/sherpa/onnx/python/index.html

Screenshot 2023-07-22 at 12 47 29

Caet-pip commented 12 months ago

Do i need to run these in Terminal of Visual Studio to work?

Caet-pip commented 12 months ago

Its working in Windows Command Line outside of Visual Studio, thank you so much for the help!!

Caet-pip commented 12 months ago

Can I close this issue?

csukuangfj commented 12 months ago

No,you can use what you are using for running python scripts.

There is nothing special about sherpa-onnx.

Please follow the documentation.

Caet-pip commented 12 months ago

I didnt understand what you meant by using what I was using for running python scripts, could you please clarify that?

csukuangfj commented 12 months ago

What environment you are currently using should work for running sherpa-onnx in Python. There is nothing special about sherpa-onnx. You don't need to use a special environment, e.g., visual studio commandline, to run sherpa-onnx.


Can I close this issue?

Yes, I think so. If you have any issues, please ask again.

Caet-pip commented 12 months ago

Thanks for the clarification, if I have any other issue I will ask. Thanks again!

csukuangfj commented 12 months ago

By the way, which version of Python and PyTorch are you using? I can provide a pre-compiled kaldifeat wheel for you.

Caet-pip commented 12 months ago

Thank you so much for this Python version 3.11.4 Pytorch version 2.0.1+cu117

csukuangfj commented 12 months ago

Does a CPU version of kaldifeat work for you?

By the way, sherpa-onnx depends on neither PyTorch nor kaldifeat.

Caet-pip commented 11 months ago

Yes CPU version would be great

I am using sherpa-onnx now, it works great!

csukuangfj commented 11 months ago

You can find pre-compiled wheels of kaldifeat for windows at https://csukuangfj.github.io/kaldifeat/installation/from_wheels.html#windows-cpu


If you are using sherpa-onnx, then I think you don't need to install kaldifeat any longer.