Python pip on WIndows - command error "cl.exe" - python

I am trying to install PyAudio using pip install PyAudio, but I get this error:
(venv) C:\Users\PC\PycharmProjects\untitled>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\PC\PycharmProjects\untitled\venv\Scripts\python.exe -u -c "import setuptools, tokenize;_
_file__='C:\\Users\\PC\\AppData\\Local\\Temp\\pip-install-z9jx52y1\\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\PC\AppData\Local\T
emp\pip-record-dzl_covu\install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\PC\PycharmProj
ects\untitled\venv\include\site\python3.7\PyAudio:
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
creating build\temp.win32-3.7
creating build\temp.win32-3.7\Release
creating build\temp.win32-3.7\Release\src
cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT -IC:\Users\PC\PycharmProjects\untitled\venv\include -IC:\Users\PC\AppData\Local\Pro
grams\Python\Python37-32\include -IC:\Users\PC\AppData\Local\Programs\Python\Python37-32\include "-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\ucrt" "-IC:\Program Fi
les (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win32-3.7\Release\src/_portaudiomodule.o
bj
error: command 'cl.exe' failed: No such file or directory
----------------------------------------
Command "C:\Users\PC\PycharmProjects\untitled\venv\Scripts\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PC\\
AppData\\Local\\Temp\\pip-install-z9jx52y1\\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\PC\AppData\Local\Temp\pip-record-dzl_covu\
install-record.txt --single-version-externally-managed --compile --install-headers C:\Users\PC\PycharmProjects\untitled\venv\inclu
de\site\python3.7\PyAudio" failed with error code 1 in C:\Users\PC\AppData\Local\Temp\pip-install-z9jx52y1\PyAudio\
You are using pip version 10.0.1, however version 19.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
I also tried using pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl, but I got the same problem...

Run your command prompt as administrator and add Full path of cl.exe to Path environment variable.

Related

ipywidgets install issue on python

I tried to install 'ipywidgets' on my Python. I used both 'pip install ipywidgets' and 'pip3 install ipywidgets'
but neither is working.
Can you please help me how to install ipywidgets? It needs for tqdm.
I have a long error log as below:
Installing collected packages: pywinpty, pandocfilters, nbclient, mistune, jupyterlab-pygments, jinja2, ipython, entrypoints, defusedxml, cffi, bleach, terminado, Send2Trash, prometheus-client, nbconvert, ipykernel, argon2-cffi, notebook, widgetsnbextension, jupyterlab-widgets, ipywidgets
Running setup.py install for pywinpty ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\mpa3209794\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\setup.py'"'"'; __file__='"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\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\MPA3209794\AppData\Local\Temp\pip-record-izffzjgx\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mpa3209794\appdata\local\programs\python\python39\Include\pywinpty'
cwd: C:\Users\MPA3209794\AppData\Local\Temp\pip-install-8y79y8w4\pywinpty_b841185b2a294deca64a008a83fa371c\
Complete output (25 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\winpty
copying winpty\ptyprocess.py -> build\lib.win-amd64-3.9\winpty
copying winpty\winpty_wrapper.py -> build\lib.win-amd64-3.9\winpty
copying winpty\__init__.py -> build\lib.win-amd64-3.9\winpty
creating build\lib.win-amd64-3.9\winpty\tests
copying winpty\tests\test_cywinpty.py -> build\lib.win-amd64-3.9\winpty\tests
copying winpty\tests\test_ptyprocess.py -> build\lib.win-amd64-3.9\winpty\tests
copying winpty\tests\test_winpty_wrapper.py -> build\lib.win-amd64-3.9\winpty\tests
copying winpty\tests\__init__.py -> build\lib.win-amd64-3.9\winpty\tests
creating build\lib.win-amd64-3.9\winpty\_winpty
copying winpty\_winpty\__init__.py -> build\lib.win-amd64-3.9\winpty\_winpty
running build_ext
building 'winpty.cywinpty' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\winpty
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\mpa3209794\appdata\local\programs\python\python39\include -Ic:\users\mpa3209794\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt /Tcwinpty/cywinpty.c /Fobuild\temp.win-amd64-3.9\Release\winpty/cywinpty.obj
cywinpty.c
winpty/cywinpty.c(629): fatal error C1083: Cannot open include file: 'winpty.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\mpa3209794\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\setup.py'"'"'; __file__='"'"'C:\\Users\\MPA3209794\\AppData\\Local\\Temp\\pip-install-8y79y8w4\\pywinpty_b841185b2a294deca64a008a83fa371c\\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\MPA3209794\AppData\Local\Temp\pip-record-izffzjgx\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\mpa3209794\appdata\local\programs\python\python39\Include\pywinpty' Check the logs for full command output.
Have you tried installing with anaconda? Try installing only ipywidgets and notebook before installing other packages. Install anaconda and then create a new conda environment with
conda create -c conda-forge -n [name] ipywidgets notebook where [name] is the name you can choose for your environment. The two packages ipywidgets and notebook will be installed to start.
conda activate [name] to switch to the newly created environment
ipython kernel install --name [name] --display-name "[name]" --sys-prefix to install the kernel.
Now you should be able to run jupyter notebook and verify ipywidgets is working correctly.

Unable to install PyAudio on Python 3.9

I'm trying to install PyAudio on Python 3.9 and it is not working. I am getting the following error:
ERROR: Command errored out with exit status 1:
command: 'c:\users\koffie\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\koffie\\AppData\\Local\\Temp\\pip-install-8fxj755j\\pyaudio_3c7b865f50cd493eaf257dea132d1fe1\\setup.py'"'"'; __file__='"'"'C:\\Users\\koffie\\AppData\\Local\\Temp\\pip-install-8fxj755j\\pyaudio_3c7b865f50cd493eaf257dea132d1fe1\\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\koffie\AppData\Local\Temp\pip-record-9go3oms0\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\koffie\appdata\local\programs\python\python39\Include\pyaudio'
cwd: C:\Users\koffie\AppData\Local\Temp\pip-install-8fxj755j\pyaudio_3c7b865f50cd493eaf257dea132d1fe1\
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
copying src\pyaudio.py -> build\lib.win-amd64-3.9
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -Ic:\users\koffie\appdata\local\programs\python\python39\include -Ic:\users\koffie\appdata\local\programs\python\python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29910\include -IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt -IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041. _portaudiomodule.c
c:\users\koffie\appdata\local\programs\python\python39\include\pyconfig.h(117): warning C4005: 'MS_WIN64': macro redefinition
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29910\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\koffie\appdata\local\programs\python\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\koffie\\AppData\\Local\\Temp\\pip-install-8fxj755j\\pyaudio_3c7b865f50cd493eaf257dea132d1fe1\\setup.py'"'"'; __file__='"'"'C:\\Users\\koffie\\AppData\\Local\\Temp\\pip-install-8fxj755j\\pyaudio_3c7b865f50cd493eaf257dea132d1fe1\\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\koffie\AppData\Local\Temp\pip-record-9go3oms0\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\koffie\appdata\local\programs\python\python39\Include\pyaudio' Check the logs for full command output.
I have tried downloading Visual Basic Tools, as well as, I have tried doing the pip install pipwin and then PyAudio function. But unfortunately the same error occurred. I also tried downloading the following and installing it: PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
I am trying to build an Alexa-like AI, and need this PyAudio package.
Perhaps try pip install pipwin and then pipwin install pyaudio? pipwin is designed to work on Windows, so you may have better luck with it.
As of today 10-03-2022 , you have following options:
use python 3.6 (wheels available), probably you don't want to give up on the latest python version because of this dependency, but this is an easy option.
you build it from source, probably will take you some effort.
you download the wheel package from gohlke's page and tell pip to use that wheel instead of downloading it from pypi.

Getting error in installing in PyAudio module

After trying countless times I still cannot install PyAudio without getting this error
I have tried using many approaches including pipwin which doesn't get recognized as a real function, how can I install PyAudio?
ERROR: Command errored out with exit status 1:
command: 'C:\person\person\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\person\\AppData\\Local\\Temp\\pip-install-csmluknr\\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\\setup.py'"'"'; __file__='"'"'C:\\Users\\person\\AppData\\Local\\Temp\\pip-install-csmluknr\\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\\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\person\AppData\Local\Temp\pip-record-tj523gnc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\person\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Include\PyAudio'
cwd: C:\Users\person\AppData\Local\Temp\pip-install-csmluknr\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\
Complete output (17 lines):
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\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-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" /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.7\Release\src/_portaudiomodule.obj
_portaudiomodule.c
C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.7_3.7.2544.0_x64__qbz5n2kfra8p0\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\\2019\\Community\\VC\\Tools\\MSVC\\14.27.29110\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\person\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\person\\AppData\\Local\\Temp\\pip-install-csmluknr\\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\\setup.py'"'"'; __file__='"'"'C:\\Users\\person\\AppData\\Local\\Temp\\pip-install-csmluknr\\pyaudio_4df1e1a74cd34515a3cf4ed28ceefeae\\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\person\AppData\Local\Temp\pip-record-tj523gnc\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\person\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Include\PyAudio' Check the logs for full command output.
You can install PyAudio by first installing:
pip install pipwin
Wait until it's done, then:
pipwin install pyaudio
It will work for people who have Python 3.9.
You can download PyAudio wheel file from here.
Then use pip install XXX.whl to install.
For example: pip install E:/PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl
You can check how many bits your computer is, and then download the corresponding wheel.
PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl supports python3.7 for windows 64-bit system.
PyAudio‑0.2.11‑cp37‑cp37m‑win32.whl supports python3.7 for windows 32-bit system.
If Anaconda is installed, we can also use the conda installation tool to install the module "PyAudio" in VSCode: (conda install PyAudio)
Reference: Environment in VSCode.
The suggestion by Aman above works for me, within the Anaconda3 environment, using the Anaconda3 Prompt.
First run this:
pip install pipwin
Then run this:
pipwin install pyaudio
Prior to this, I did install the Microsoft Visual Build Tools. It DID NOT help.
Similar issue found in previous Stackoverflow question.

Not able to install py audio: pip install pyaudio [duplicate]

This question already has answers here:
How to fix installation issues for PyAudio, PortAudio: "fatal error C1083: Cannot open include file: 'portaudio.h': No such file or directory"
(10 answers)
Closed 2 years ago.
Not able to install py audio: pip install pyaudio
using pycharm
now the error has changed to this, The module is listed (PyAudio-0.2.11.tar.gz) but then it returns an error (ERROR: Command errored out with exit status 1:):
(venv) C:\Users\admin\PycharmProjects\pythonProject2>pip install pyaudio
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Using legacy 'setup.py install' for pyaudio, since package 'wheel' is not installed.
Installing collected packages: pyaudio
Running setup.py install for pyaudio ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\admin\pycharmprojects\pythonproject2\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\admin\
\AppData\\Local\\Temp\\pip-install-oygnlr22\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-oygnlr22\\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\admin\AppData\Local\Temp\pip-record-mnp5i0dx\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\
users\admin\pycharmprojects\pythonproject2\venv\include\site\python3.9\pyaudio'
cwd: C:\Users\admin\AppData\Local\Temp\pip-install-oygnlr22\pyaudio\
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
copying src\pyaudio.py -> build\lib.win-amd64-3.9
running build_ext
building '_portaudio' extension
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
creating build\temp.win-amd64-3.9\Release\src
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -DMS_WIN64=
1 -Ic:\users\admin\pycharmprojects\pythonproject2\venv\include -IC:\Users\admin\AppData\Local\Programs\Python\Python39\include -IC:\Users\admin\AppData\Local\Progr
ams\Python\Python39\include -IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.28.29333\include -IC:\Program Files (x86)\Windows Kit
s\NETFXSDK\4.8\include\um -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)\Window
s Kits\10\include\10.0.18362.0\cppwinrt /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.9\Release\src/_portaudiomodule.obj
_portaudiomodule.c
C:\Users\admin\AppData\Local\Programs\Python\Python39\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\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.28.29333\\bin\\HostX86\\x64\\cl.exe' failed with exit c
ode 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\admin\pycharmprojects\pythonproject2\venv\scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys
.argv[0] = '"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-oygnlr22\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-ins
tall-oygnlr22\\pyaudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compil
e(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\admin\AppData\Local\Temp\pip-record-mnp5i0dx\install-record.txt' --single-version-externally-managed
--compile --install-headers 'c:\users\admin\pycharmprojects\pythonproject2\venv\include\site\python3.9\pyaudio' Check the logs for full command output.
First run your CMD as Administrator and run the following
pip install pipwin
pipwin install pyaudio

Can't install pyaudio using pip [duplicate]

This question already has answers here:
How do I install PyAudio on Python 3.7?
(9 answers)
Closed 3 years ago.
I tried installing pyaudio using pip but I am getting an error.
C:\Users\divya>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:\program files (x86)\python37-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\divya\\AppData\\Local\\Temp\\pip-install-5eoc_ykq\\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\divya\AppData\Local\Temp\pip-record-xhzsi_4l\install-record.txt --single-version-externally-managed --compile:
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
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\2019\BuildTools\VC\Tools\MSVC\14.22.27905\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MT "-Ic:\program files (x86)\python37-32\include" "-Ic:\program files (x86)\python37-32\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.22.27905\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" /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\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.22.27905\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
----------------------------------------
Command ""c:\program files (x86)\python37-32\python.exe" -u -c "import setuptools, tokenize;__file__='C:\\Users\\divya\\AppData\\Local\\Temp\\pip-install-5eoc_ykq\\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\divya\AppData\Local\Temp\pip-record-xhzsi_4l\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\divya\AppData\Local\Temp\pip-install-5eoc_ykq\pyaudio\
please see this error and help me out I am getting similar error while installing pyGTK too. I tried upgrading pip too but nothing worked for me.
There is no prebuilt package for Python 3.7 on Windows (you have a 32 bit version probably) so you need to prepare build environment on your PC to use this package. Easier would be finding the wheel for 3.7 as some packages are quite hard to build on Windows.
You can find your wheel here
Check your python version and download your correct wheel
after that you can type to install:
pip install <yourwheel.whl>

Categories