pyaudio Library Installation Error How to fix it - python

When installing pyaudio in the command prompt with:
python -m pip install pyaudio
I get an error:
ERROR: Complete output from command 'C:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-c823_6j8\\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-vkr4rksd\install-record.txt' --single-version-externally-managed --compile:
ERROR: 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
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command "'C:\python\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\admin\\AppData\\Local\\Temp\\pip-install-c823_6j8\\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-vkr4rksd\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\admin\AppData\Local\Temp\pip-install-c823_6j8\pyaudio\

You can simply grab the proper Wheel package for your current Python version from here
and then install it with pip install <PyAudio‑0.2.11-...>.whl. (remember to use full filename (e.g pip install PyAudio‑0.2.11‑cp37‑cp37m‑win_amd64.whl).

You don't need to download or any Microsoft Visual C++ Build Tools. Just do the following, it will be an ultimate fix:
After you go to this link: https://www.lfd.uci.edu/~gohlke/pythonlibs/ select and download the PyAudio for your Python version.
I downloaded:
PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
Place the downloaded file into the Scrips folder. My folder structure is:
`C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts`
Then you need to install the downloaded script by using the command:
python -m pip install "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl"

Related

Not able to install pyaudio of python

when I am trying to install pyaudio an error occurs that is this:-
please help me
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\acer\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\acer\\AppData\\Local\\Temp\\pip-install-4r2yz81m\\pyaudio_7658f0f23b7e4c5593332ef0c870e763\\setup.py'"'"'; __file__='"'"'C:\\Users\\acer\\AppData\\Local\\Temp\\pip-install-4r2yz81m\\pyaudio_7658f0f23b7e4c5593332ef0c870e763\\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\acer\AppData\Local\Temp\pip-record-jto6it74\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\acer\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pyaudio'
cwd: C:\Users\acer\AppData\Local\Temp\pip-install-4r2yz81m\pyaudio_7658f0f23b7e4c5593332ef0c870e763\
Complete output (9 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
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\acer\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\acer\\AppData\\Local\\Temp\\pip-install-4r2yz81m\\pyaudio_7658f0f23b7e4c5593332ef0c870e763\\setup.py'"'"'; __file__='"'"'C:\\Users\\acer\\AppData\\Local\\Temp\\pip-install-4r2yz81m\\pyaudio_7658f0f23b7e4c5593332ef0c870e763\\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\acer\AppData\Local\Temp\pip-record-jto6it74\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\acer\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Include\pyaudio' Check the logs for full command output.
https://pypi.org/project/PyAudio/#files
It shows wheels for python 2.7, 3.4, 3.5 & 3.6 .. And since you do not have bdist_wheel AND you are on python 3.9, source installation is done.
And because pyaudio has native code parts that need to be compiled (because wheel is not available) - you need to have working Visual Studio installed on your machine. Exactly as ther error message says:
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
error: Microsoft Visual C++ 14.0 is required download visual c++ build tools : https://visualstudio.microsoft.com/visual-cpp-build-tools/

I am not able to install Pyaudio in my windows 10

When I Write pip install pyaudio or -m pip install PyAudio
Then it shows an error like bellow -
ERROR: Command errored out with exit status 1:
command: 'C:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudio\\setup.py'"'"'; __file__='"'"'C
:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudio\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();ex
ec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\SUDHAN~1\AppData\Local\Temp\pip-record-b0h1w_j0\install-record.txt' --single-version-externally-managed --compile --install-headers
'C:\python37\Include\PyAudio'
cwd: C:\Users\SUDHAN~1\AppData\Local\Temp\pip-install-zern0h1s\PyAudio\
Complete output (9 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
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\PyAudi
o\\setup.py'"'"'; __file__='"'"'C:\\Users\\SUDHAN~1\\AppData\\Local\\Temp\\pip-install-zern0h1s\\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\SUDHAN~1\AppData\Local\Temp\pip-record-b0h1w_j0\install-record.txt' --single-version-externally-ma
naged --compile --install-headers 'C:\python37\Include\PyAudio' Check the logs for full command output.
Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools
You need install MS VS here
As the error says, install Microsoft Visual C++ 14.0 - it provides required build tools. You can download it from here. Also, to avoid majority of such problems in future, make sure you have Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019 - install all of them.
Step 1: Download the Pyaudio from this website
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Depending on your python version
Step 2: then open cmd on the same directory where pyaudio is downloaded
Step 3: Then type this command: pip install pyaudiofilename
for example
pip install PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
i hope it will work!
i also tried all of these answers but none of these works!
so i tried this solution and it worked!
Here is the ScreenShot!
Before
After
Download Visual Studio installer.
After the installer is installed, launch it and go to the Workloads tab and select C++ build tools and install them.
After installing C++ build tools, try installing PyAudio in a new Command Prompt window.
Remember: install PyAudio in a new command prompt window after closing the previous window.

CMD is not installing my packages using pip

Having errors on cmd as admin trying to install new modules even re-installed python to get newest version, and keeps failing!
Modules I have tried
pip install pyaudio
pip install smtplib
AND MANY Others
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
ERROR: Command errored out with exit status 1:
command: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\marcu\\AppData\\Local\\Temp\\pip-install-9lkkindd\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\marcu\\AppData\\Local\\Temp\\pip-install-9lkkindd\\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\marcu\AppData\Local\Temp\pip-record-dwdolxb5\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\marcu\AppData\Local\Temp\pip-install-9lkkindd\pyaudio\
Complete output (9 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
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\program files (x86)\python37-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\marcu\\AppData\\Local\\Temp\\pip-install-9lkkindd\\pyaudio\\setup.py'"'"'; __file__='"'"'C:\\Users\\marcu\\AppData\\Local\\Temp\\pip-install-9lkkindd\\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\marcu\AppData\Local\Temp\pip-record-dwdolxb5\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
yes you must download visual c++ 14 on microsoft website(optionnal) before! try after install
update your pip also!
try this link https://www.techspot.com/downloads/6776-visual-c-redistributable-package.html

install the PortAudio Python bindings first and pyaudio

when i run my code in windows 10, I encounter this error
Please build and install the PortAudio Python bindings first.
i install pyaudio but in install pyaudio I faced with this error
ERROR: Complete output from command 'c:\users\epic_r_r\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Epic_R_R\\AppData\\Local\\Temp\\pip-install-n7_2px9c\\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\Epic_R_R\AppData\Local\Temp\pip-record-klf4pk78\install-record.txt' --single-version-externally-managed --compile:
ERROR: 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
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command "'c:\users\epic_r_r\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Epic_R_R\\AppData\\Local\\Temp\\pip-install-n7_2px9c\\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\Epic_R_R\AppData\Local\Temp\pip-record-klf4pk78\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Epic_R_R\AppData\Local\Temp\pip-install-n7_2px9c\PyAudio\
I installed it from another way, but I do not think it's installed properly
please help me i really need this
it seems like your package is not installed properly so, first of all, undo all the setup you do
try to uninstall and reinstall using pip
python -m pip install pyaudio
or you can try using wheel (click here to get wheel file)
pip install PyAudio-0.2.11-cp37-cp37m-win32.whl
if it is not working then try to install using anaconda
conda install -c anaconda pyaudio
I was with the same problem, I discovery that PyAudio does not support versions larger than 3.6. You can see the supported versions at this link: PyAudio
To solve this problem, I start using python 3.6.8.
Available to Download from the official Python website.
I hope this helps.

Can't install PyAudio in python [duplicate]

This question already has answers here:
I can't install pyaudio on Windows? How to solve "error: Microsoft Visual C++ 14.0 is required."?
(17 answers)
Closed 2 years ago.
I get the following ERROR while installing pyaudio
C:\Users\Admin\Downloads>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
ERROR: Complete output from command 'c:\users\admin\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-snth_fqh\\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-3n7dvpm8\install-record.txt' --single-version-externally-managed --compile:
ERROR: 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
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command "'c:\users\admin\appdata\local\programs\python\python37\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-snth_fqh\\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-3n7dvpm8\install-record.txt' --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Admin\AppData\Local\Temp\pip-install-snth_fqh\pyaudio\
You are missing Visual C++ from your computer. Download and install from here: https://www.microsoft.com/en-us/download/details.aspx?id=48145
and then re run the install for PyAudio.
Visual Studio changed the Build Tools from being C++ specific in late 2017. Thus newer Visual Studio versions work in place of older versions.
You can install it using:
1.https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
2.https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019
Windows Python needs Visual C++ libraries installed via the SDK to build code.

Categories

Resources