I am a beginner in python language. I have written a test function in python for converting speech-to-text :
def getAudioFromMicrophone():
r = sr.Recognizer()
with sr.Microphone() as source:
lets_talk.in_female_voice('I am ready for your next command')
r.pause_threshold=1
r.adjust_for_ambient_noise(source,duration=1)
return r.listen(source)
When I run it, it says :
File "D:/PycharmProjects/python-modules/jarvis/jarvis.py", line 5,
in
import pyaudio ModuleNotFoundError: No module named 'pyaudio'
So, I am trying to install pyaudio in my windows 10 which is again showing an error.
Collecting pyaudio Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz Installing collected packages: pyaudio Running setup.py install for pyaudio: started
Running setup.py install for pyaudio: finished with status 'error'
Complete output from command D:\softwares\python-compiler\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pycharm-packaging\\pyaudio\\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\username\AppData\Local\Temp\pip-record-9qmland0\install-record.txt
--single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying src\pyaudio.py -> build\lib.win-amd64-3.7
warning: build_py: byte-compiling is disabled, skipping.
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1
-ID:\softwares\python-compiler\include -ID:\softwares\python-compiler\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
_portaudiomodule.c
d:\softwares\python-compiler\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Command "D:\softwares\python-compiler\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\username\\AppData\\Local\\Temp\\pycharm-packaging\\pyaudio\\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\username\AppData\Local\Temp\pip-record-9qmland0\install-record.txt
--single-version-externally-managed --compile" failed with error code 1 in C:\Users\username\AppData\Local\Temp\pycharm-packaging\pyaudio\ You are using pip version 18.1, however version 19.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Any sort of help will be appreciated!
This is a problem with Python 3.7 because there isn't a PyAudio wheel for this version of Python for pip to find. To solve this, download a wheel that fits your computer's specs from here. Now, navigate to the folder the wheel was downloaded to in the command prompt and run: pip install (name of the .whl file here). This should work fine if you are on Windows and using Python 3.7.
I got this information from this post.
Try below commands to install the pyaudio on "Windows 10".
pip install pipwin
pipwin install pyaudio
Follow the steps
Step1. Download the PyAudio-0.2.11-cp310-cp310-win_amd64.whl from this link https://pypi.bartbroe.re/pyaudio
Step2. Use the following comand in cmd pip install (path to the file)/PyAudio-0.2.11-cp310-cp310-win_amd64.whl
Now it will install in my case hope this will help you too.
Related
I am trying to install cld3 with pip on Python 3.9. I have successfully installed protoc and also got the C++ build tools with Visual Studio, however when I run py -m pip install -U pycld3 it fails with a few messages. I am on windows 10 running Python 3.9
It initially fails to build using wheel:
Collecting pycld3
Using cached pycld3-0.21.tar.gz (652 kB)
Building wheels for collected packages: pycld3
Building wheel for pycld3 (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\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\Charlie\AppData\Local\Temp\pip-wheel-_9ez3o7a'
cwd: C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\
Complete output (23 lines):
running bdist_wheel
running build
Creating dirs at C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/
This is not surprising as it mentions in the docs that wheel installation is not supported for my OS. However I really do not understand what happens next:
Running protoc sentence.proto feature_extractor.proto task_spec.proto --cpp_out=C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\cld3
copying cld3\__init__.py -> build\lib.win-amd64-3.9\cld3
running build_ext
building 'cld3._cld3' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\cld3
creating build\temp.win-amd64-3.9\Release\src
creating build\temp.win-amd64-3.9\Release\src\cld_3
creating build\temp.win-amd64-3.9\Release\src\cld_3\protos
creating build\temp.win-amd64-3.9\Release\src\script_span
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/ -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /EHsc /Tpcld3/pycld3.cpp /Fobuild\temp.win-amd64-3.9\Release\cld3/pycld3.obj -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
pycld3.cpp
c1xx: fatal error C1083: Cannot open source file: 'cld3/pycld3.cpp': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Failed building wheel for pycld3
Running setup.py clean for pycld3
Failed to build pycld3
Installing collected packages: pycld3
Running setup.py install for pycld3 ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\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\Charlie\AppData\Local\Temp\pip-record-fkxpsotm\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\Include\pycld3'
cwd: C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\
Complete output (22 lines):
running install
running build
Running protoc sentence.proto feature_extractor.proto task_spec.proto --cpp_out=C:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\cld3
copying cld3\__init__.py -> build\lib.win-amd64-3.9\cld3
running build_ext
building 'cld3._cld3' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\cld3
creating build\temp.win-amd64-3.9\Release\src
creating build\temp.win-amd64-3.9\Release\src\cld_3
creating build\temp.win-amd64-3.9\Release\src\cld_3\protos
creating build\temp.win-amd64-3.9\Release\src\script_span
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/ -IC:\Users\Charlie\AppData\Local\Temp\pip-install-hl9cd_fj\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\src/cld_3/protos/ -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Users\Charlie\AppData\Local\Programs\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\ATLMFC\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt /EHsc /Tpcld3/pycld3.cpp /Fobuild\temp.win-amd64-3.9\Release\cld3/pycld3.obj -std=c++11
cl : Command line warning D9002 : ignoring unknown option '-std=c++11'
pycld3.cpp
c1xx: fatal error C1083: Cannot open source file: 'cld3/pycld3.cpp': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\setup.py'"'"'; __file__='"'"'C:\\Users\\Charlie\\AppData\\Local\\Temp\\pip-install-hl9cd_fj\\pycld3_6beaeb0f5dd847eab99d4f8bff3bd60a\\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\Charlie\AppData\Local\Temp\pip-record-fkxpsotm\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Charlie\AppData\Local\Programs\Python\Python39\Include\pycld3' Check the logs for full command output.
As far as I can tell it is because it cannot find "cld3/pycld3.cpp"". Do I need to run an earlier version of Python? Thanks in advance
This is a bug in pycld3: they've forgotten to include the source into sdist. Please report the bug.
Meanwhile the workaround is to install Cython:
pip install Cython
pip install pycld3
[pycld3 maintainer] This issue should be resolved in pycld3 release 0.22.
python3 -m pip install -U pycld3
As #phd points out, this was an error with the distribution upload in 0.21 that neglected to include the intermediate .cpp file. Inclusion of that file in the sdist should not be dependent on the build-time logic of whether a user has or wants to use Cython.
Note that in the 0.22 release, the installation will respect the environment variable USE_CYTHON=1. You must have an existing install of Cython to use this flag. It will force re-compilation from the source .pyx file. This follows the behavior recommended at Distributing Cython Modules.
0.22 also drops support for end-of-life Python 3.5 and no longer passes the unsupported -std=c++11 on Windows MSVC.
Detail: full changelog from 0.21 to 0.22.
I'm not able to install python-snappy module. I have successfully installed snappy module first but getting below error for python-snappy.
(new-env) C:\Automation\test-automation\connect>pip install python-snappy
Collecting python-snappy
Using cached https://files.pythonhosted.org/packages/45/35/65d9f8cc537129894b4b32647d80212d1fa342877581c5b8a69872cea8be/python-snappy-0.5.4.tar.gz
Installing collected packages: python-snappy
Running setup.py install for python-snappy ... error
Complete output from command C:\Automation\test-automation\new-env\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\vagrant\\AppData\\Local\\Temp\\
2\\pip-install-17b8xwg1\\python-snappy\\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\vagrant\AppData\Local\Temp\2\pip-record-vdvhb6a5\install-record.txt --single-version-externally-managed --compile --install-headers C:\Automation\tes
t-automation\new-env\include\site\python3.7\python-snappy:
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
creating build\lib.win32-3.7\snappy
copying snappy\hadoop_snappy.py -> build\lib.win32-3.7\snappy
copying snappy\snappy.py -> build\lib.win32-3.7\snappy
copying snappy\snappy_cffi.py -> build\lib.win32-3.7\snappy
copying snappy\snappy_cffi_builder.py -> build\lib.win32-3.7\snappy
copying snappy\snappy_formats.py -> build\lib.win32-3.7\snappy
copying snappy\__init__.py -> build\lib.win32-3.7\snappy
copying snappy\__main__.py -> build\lib.win32-3.7\snappy
running build_ext
building 'snappy._snappy' extension
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\snappy
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Automation\test-automation\new-env\include "-IC:\Program Files (x8
6)\Python37-32\include" "-IC:\Program Files (x86)\Python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\
10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows
Kits\8.1\include\winrt" /EHsc /Tpsnappy/snappymodule.cc /Fobuild\temp.win32-3.7\Release\snappy/snappymodule.obj
snappymodule.cc
snappy/snappymodule.cc(31): fatal error C1083: Cannot open include file: 'snappy-c.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2
----------------------------------------
Command "C:\Automation\test-automation\new-env\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\vagrant\\AppData\\Local\\Temp\\2\\pip-install-17b8xwg1\
\python-snappy\\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:\Us
ers\vagrant\AppData\Local\Temp\2\pip-record-vdvhb6a5\install-record.txt --single-version-externally-managed --compile --install-headers C:\Automation\test-automation\new-env\inc
lude\site\python3.7\python-snappy" failed with error code 1 in C:\Users\vagrant\AppData\Local\Temp\2\pip-install-17b8xwg1\python-snappy\
(new-env) C:\Automation\test-automation\connect>
Successfully installed snappy and Visual Studio 14.
In such cases you can download the wheel files compiled by C. Gohlke.
All you need to do is that find which dependencies you need and then search on the http://www.lfd.uci.edu/~gohlke/pythonlibs/ according to your python version.
After downloading the file, go to that file location and simply install it using pip.
For example in this case lets say you are using python 3.7 version and you want to install python-snappy then first download python_snappy‑0.5.4‑cp37‑cp37m‑win_amd64.whl and then save it on some location. Again go to that location and simply use pip install python_snappy-0.5.4-cp37-cp37m-win_amd64.whl.
That's it.
I am building a speech recognition program but can't install pyAudio.
I have installed Microsoft visual c++ 14.0.0 but still, I am getting another error. I can't understand what is going wrong here please help me out.
ERROR: Command errored out with exit status 1:
command: 'c:\users\udit\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv\[0\] = '"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\pyaudio\\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\udit\AppData\Local\Temp\pip-record-ih2tcx4k\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\udit\AppData\Local\Temp\pip-install-68co_fpl\pyaudio\
Complete output (16 lines):
running install
running build
running build_py
creating build
creating build\lib.win32-3.7
copying src\pyaudio.py -> build\lib.win32-3.7
running build_ext
building '_portaudio' extension
b'\\\x00C\x00o\x00m\x00m\x00o\x00n\x00 \x00w\x00a\x00s\x00 \x00u\x00n\x00e\x00x\x00p\x00e\x00c\x00t\x00e\x00d\x00 \x00a\x00t\x00 \x00t\x00h\x00i\x00s\x00 \x00t\x00i\x00m\x00e\x00.\x00\r\x00\n\x00'
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Bin\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\udit\appdata\local\programs\python\python37-32\include -Ic:\users\udit\appdata\local\programs\python\python37-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Include" "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\Include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.7\Release\src/_portaudiomodule.obj
_portaudiomodule.c
src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\Bin\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\udit\appdata\local\programs\python\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv\[0\] = '"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\udit\\AppData\\Local\\Temp\\pip-install-68co_fpl\\pyaudio\\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\udit\AppData\Local\Temp\pip-record-ih2tcx4k\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
These are notes for installation on Microsoft Windows:
pip will fetch and install PyAudio wheels (prepackaged binaries). Currently, there are wheels compatible with the official distributions of Python 2.7, 3.4, 3.5, and 3.6. For those versions, both 32-bit and 64-bit wheels are available.
You are using Python 3.7, which is not compatible with PyAudio. However...
EDIT:
As user #Dalen states, there are prebuilt binaries (.exe files) for pyAudio. I installed from their archive stated in documentation but importing pyAudio had an output:
There are unofficial binaries for Windows on this site: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio .
Download the proper one and install it.
Download the binary installer for Windows and just install the PyAudio package with no nonsense.
PyAudio is built on top of portaudio library and you require portaudio to be there. The binary installer comes with precompiled version of portaudio as a dynamically linked library and there is no need for hunting and compiling the source.
PyAudio is a great library, enjoy working with it.
pip install pipwin
pipwin install pyaudio
Try these commands in prompt. It does not require any manual downloads or searches etc.
pipwin is a complementary tool for pip on Windows. It is capable of installing unofficial python package binaries for Windows provided by Christoph Gohlke
the key info in the error message is "Cannot open include file: 'portaudio.h': No such file or directory"
so you should google it, and you will find it have an answer in stackoverflow:
https://stackoverflow.com/a/52191687/5232323
the current version PyAudio 0.2.11 is not supported for Python 3.7
When I am trying to install PyAudio using
pip install pyaudio
I get this error:
C:\Users\pankajkaun>pip install pyaudio
Collecting pyaudio
Using cached https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
Complete output from command c:\users\pankajkaun\desktop\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PANKAJ~1\\AppData\\Local\\Temp\\pip-install-pw8_ueh5\\pyaudio
\\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\PANKAJ~1\AppData\Local\Temp
\pip-record-eru_9orv\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
copying src\pyaudio.py -> build\lib.win-amd64-3.7
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -Ic:\users\pankajkaun\desktop\python\include -Ic:\users\pankajkaun\desktop\python\
include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-
IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:
\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
_portaudiomodule.c
c:\users\pankajkaun\desktop\python\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
src/_portaudiomodule.c: note: see previous definition of 'MS_WIN64'
src/_portaudiomodule.c(29): fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\users\pankajkaun\desktop\python\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PANKAJ~1\\AppData\\Local\\Temp\\pip-install-pw8_ueh5\\pyaudio
\\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\PANKAJ~1\AppData\Local\Temp\pip-record-eru_9orv\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\PANKAJ~1\AppData\Local\Temp\pip-install-pw8_ueh5\pyaudio\
Any idea what's going on in here?
Try this (in admin mode command prompt):
pip install pipwin
pipwin install pyaudio
pipwin is like pip, but it installs precompiled Windows binaries provided by Christoph Gohlke. Saves you a lot of googling and manual downloading.
According to official docs of pyaudio:
Microsoft Windows
Install using pip:
python -m pip install pyaudio
Notes: pip will fetch and install PyAudio wheels (prepackaged binaries). Currently, there are wheels compatible with the official distributions of Python 2.7, 3.4, 3.5, and 3.6. For those versions, both 32-bit and 64-bit wheels are available.
You try to install pyaudio for 3.7, so it try to compile it.
Download and install wheel from Gohlke - Unofficial Windows Binaries for Python Extension Packages. Wheels for 32 and 64-bit python 3.7 are available.
Use this link to download the .whl file according to the python version it supports:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Then, go to the following directory and run this command on the command prompt:
C:\Users\shris\AppData\Local\Programs\Python\Python37-32\Scripts> pip install PyAudio-0.2.11-cp37-cp37m-win32.whl
Run CMD as admin then run the following two commands:
pip install pipwin
pipwin install pyaudio
I had the same issue and I solved it by using the WHL file which you can download from:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio.
There are several versions that you can download and use.
For example, PyAudio-0.2.11-cp37-cp37m-win_amd64.whl.
For installing purposes on the command prompt, write
pip install "path"\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
It seems you need to install portaudio first.
Here is my computer configuration:
Windows 10
Python 3.8.0 installed on C:\Program Files (x86)\Python\Python38-32
I've got the same issue and i solved it with these steps:
download PyAudio‑0.2.11‑cp38‑cp38‑win32.whl from here on my computer in C:\Downloads\PyAudio-0.2.11-cp38-cp38-win32.whl
run C:\Program Files (x86)\Python\Python38-32\Scripts>pip3.8 install C:\Downloads\PyAudio-0.2.11-cp38-cp38-win32.whl --user
I'm new to machine learning and have started with a windows 8.1 pc having GeForce GTX 540M. I followed this tutorial to get started with the object detection models. I built my own dataset and tried to train it as per the tutorial but with "ssd_mobilenet_v1_coco_2017_11_17" model. But could not perform it successfully as i had troubles with the "train.py" file given in the tutorial.
So I googled and found that we have to use "model_main.py" to train the model. While trying to train using "model_main.py" I got this error:
"ImportModuleError: No module named 'pycocotools' was found"
So I tried to install the cocoapi from this link . I followed the instructions as given, but got stuck with the error shown below, I've tried a lot of solutions but nothing worked. Any help will be much appreciated.
(tensorflow1) C:\tensorflow1\models\research\object_detection>pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Collecting git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI
Cloning https://github.com/philferriere/cocoapi.git to c:\users\home\appdata\l
ocal\temp\pip-req-build-76t4e6ys
Building wheels for collected packages: pycocotools
Running setup.py bdist_wheel for pycocotools ... error
Complete output from command c:\users\home\anaconda3\envs\tensorflow1\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Home\\AppData\\Local\\Temp\\pip-req-build-76t4e6ys\\PythonAPI\\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\Home\AppData\Local\Temp\pip-wheel-4_r37hm6 --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.6
creating build\lib.win-amd64-3.6\pycocotools
copying pycocotools\coco.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\cocoeval.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\mask.py -> build\lib.win-amd64-3.6\pycocotools
copying pycocotools\__init__.py -> build\lib.win-amd64-3.6\pycocotools
running build_ext
building 'pycocotools._mask' extension
creating build\temp.win-amd64-3.6
creating build\temp.win-amd64-3.6\Release
creating build\temp.win-amd64-3.6\Release\pycocotools
creating build\temp.win-amd64-3.6\common
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c/nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\home\anaconda3\envs\tensorflow1\lib\site-packages\numpy\core\include -I../common -Ic:\users\home\anaconda3\envs\tensorflow1\include -Ic:\users\home\anaconda3\envs\tensorflow1\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj
_mask.c
c:\users\home\anaconda3\envs\tensorflow1\include\pyconfig.h(59): fatal error C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
Failed building wheel for pycocotools
Running setup.py clean for pycocotools
Complete output from command c:\users\home\anaconda3\envs\tensorflow1\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Home\\AppData\\Local\\Temp\\pip-req-build-76t4e6ys\\PythonAPI\\setup.py';f=getattr(tokenize, 'open',open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\Home\AppData\Local\Temp\pip-req-build-76t4e6ys\PythonAPI\setup.py", line 25, in <module>
cythonize(ext_modules)
File "c:\users\home\anaconda3\envs\tensorflow1\lib\site-packages\Cython\Build\Dependencies.py", line 956, in cythonize
aliases=aliases)
File "c:\users\home\anaconda3\envs\tensorflow1\lib\site-packages\Cython\Buil
d\Dependencies.py", line 801, in create_extension_list
for file in nonempty(sorted(extended_iglob(filepattern)), "'%s' doesn't ma
tch any files" % filepattern):
File "c:\users\home\anaconda3\envs\tensorflow1\lib\site-packages\Cython\Buil
d\Dependencies.py", line 111, in nonempty
raise ValueError(error_msg)
ValueError: 'pycocotools/_mask.pyx' doesn't match any files
----------------------------------------
Failed cleaning build dir for pycocotools
Failed to build pycocotools
Installing collected packages: pycocotools
Running setup.py install for pycocotools ... error
Complete output from command c:\users\home\anaconda3\envs\tensorflow1\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Home\\AppData\\Local\\Temp\\pip-req-build-76t4e6ys\\PythonAPI\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext "-L/C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/ucrt" install --record C:\Users\Home\AppData\Local\Temp\pip-record-ykypadav\install-record.txt --single-version-externally-managed --compile:
running build_ext
building 'pycocotools._mask' extension
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe /c/nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\home\anaconda3\envs\tensorflow1\lib\site-packages\numpy\core\include -I../common -Ic:\users\home\anaconda3\envs\tensorflow1\include -Ic:\users\home\anaconda3\envs\tensorflow1\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726\include" /Tcpycocotools/_mask.c /Fobuild\temp.win-amd64-3.6\Release\pycocotools/_mask.obj
_mask.c
c:\users\home\anaconda3\envs\tensorflow1\include\pyconfig.h(59): fatal error
C1083: Cannot open include file: 'io.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe' failed with exit
status 2
----------------------------------------
Command "c:\users\home\anaconda3\envs\tensorflow1\python.exe -u -c "import setup
tools, tokenize;__file__='C:\\Users\\Home\\AppData\\Local\\Temp\\pip-req-build-76t4e6ys\\PythonAPI\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" build_ext "-L/C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/ucrt" install --record C:\Users\Home\AppData\Local\Temp\pip-record-ykypadav\install-record.txt --single-version-externally-managed --compile" failed with error code 1
in C:\Users\Home\AppData\Local\Temp\pip-req-build-76t4e6ys\PythonAPI
(tensorflow1) C:\tensorflow1\models\research\object_detection>
easy fix, use pip install pycocotools-windows
First install Visual C++ 2015 Build Tools from https://go.microsoft.com/fwlink/?LinkId=691126 with default selection.
Then,
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^&subdirectory=PythonAPI
you can try:
pip install pycocotools-windows
it's worked for me :) on windows station :
I was getting the same error
ValueError: 'pycocotools/_mask.pyx' doesn't match any files
So I cloned https://github.com/waleedka/coco to my local device. Then when I was running make I was getting the above error.
the exact command I was running was--
C:\Users\Admin\Desktop\coco-master>python3 PythonAPI/setup.py build_ext install
I was when I was running above command I got the problem.
Then I found out a solution on the issues page of the same repository. It happens that you have to cd into PythonAPI then run--
python setup.py build_ext --inplace
That solved some problems for me.
Moreover some people were saying they still got problems but when they used python3 instead of python their problem was solved.
Try the following command (it worked for me on Windows 10, Python 3.7.5, and Visual 2017) :
pip3 install "git+https://github.com/philferriere/cocoapi.git#egg=pycocotools&subdirectory=PythonAPI"
(from https://github.com/cocodataset/cocoapi/issues/169#issuecomment-462528628)
If you are getting this ERROR: Command errored out with exit status 1 or 2
Then install this:
pip install git+https://github.com/philferriere/cocoapi.git#egg=pycocotools^subdirectory=PythonAPI
pip install pycocotools-windows
worked for me