daanzu / kaldi-active-grammar

Python Kaldi speech recognition with grammars that can be set active/inactive dynamically at decode-time
GNU Affero General Public License v3.0
337 stars 50 forks source link

Precompiled webrtcvad Python 3 #14

Closed LexiconCode closed 4 years ago

LexiconCode commented 4 years ago

This is not so much of a problem for 2.7 due to the standalone installer "Microsoft Visual C++ Compiler for Python 2.7" or plus your precompiled version. However for Python 3 it looks like Visual Studio is required. Due to restrictions in some outside of DEV environments may not be possible for the end user to install Microsoft Python Compiler.

daanzu commented 4 years ago

Ah, thanks for reminding me. I had posted a binary wheel for 2.7, back when 3 wasn't supported by KaldiAG, and had forgotten about it.

daanzu commented 4 years ago

I created webrtcvad-wheels as a solution, providing wheels for pretty much everything. It should be a drop-in replacement for the original webrtcvad: just pip uninstall webrtcvad and pip install webrtcvad-wheels. It uses the same import statement.

@LexiconCode Can you try it and see if it works in various versions?

LexiconCode commented 4 years ago

LexiconCode Can you try it and see if it works in various versions?

py -3 -m pip install webrtcvad-wheels install successfully on Python 3.8 64-bit

Unsuccessful without a C++ compiler. py -2 -m pip install webrtcvad-wheels python 2.7.17 32-bit python -m pip install webrtcvad-wheels python 2.7.13 64-bit (portable environment)

  Using cached webrtcvad-wheels-2.0.10.post2.tar.gz (67 kB)
Installing collected packages: webrtcvad-wheels
    Running setup.py install for webrtcvad-wheels ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\main\\appdata\\local\\temp\\pip-install-kfzjid\\webrtcvad-wheels\\setup.py'"'"'; __file__='"'"'c:\\users\\main\\appdata\\local\\temp\\pip-install-kfzjid\\webrtcvad-wheels\\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\main\appdata\local\temp\pip-record-u9iqqa\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python27\Include\webrtcvad-wheels'
         cwd: c:\users\main\appdata\local\temp\pip-install-kfzjid\webrtcvad-wheels\
    Complete output (9 lines):
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-2.7
    copying webrtcvad.py -> build\lib.win32-2.7
    running build_ext
    building '_webrtcvad' extension
    error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\main\\appdata\\local\\temp\\pip-install-kfzjid\\webrtcvad-wheels\\setup.py'"'"'; __file__='"'"'c:\\users\\main\\appdata\\local\\temp\\pip-install-kfzjid\\webrtcvad-wheels\\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\main\appdata\local\temp\pip-record-u9iqqa\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python27\Include\webrtcvad-wheels' Check the logs for full command output.`
daanzu commented 4 years ago

@LexiconCode Oops, my bad, should be fixed now?

LexiconCode commented 4 years ago

@LexiconCode Oops, my bad, should be fixed now?

Yes it is Fixed.

daanzu commented 4 years ago

Great! We will still need to replace the package specification in dragonfly/elsewhere.

LexiconCode commented 4 years ago

Sigh, As it turns out the same issue applies to pyaudio as it needs to be compiled. A unofficial precompiled version be found here

daanzu commented 4 years ago

Actually, I am planning on changing to a different sound library: https://pypi.org/project/sounddevice/. I have already implemented the change and have been testing it to make sure there are no issues. I think it should work without requiring compilation.