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.
Related
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/
C:\Users\Dell\PycharmProjects\pythonProject1>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:\python37\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-qm5dhs1u\\pyaud
io_0fa5615a0f1d45fe897d47e2b712cf51\\setup.py'"'"'; __file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-qm5dhs1u\\pyaudio_0fa5615a0f1d45fe897d47e2b712cf
51\\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\Dell\AppData\Local\Temp\pip-record-mst52wx_\install-record.txt' --single-version-externally-managed --compile --install-head
ers 'c:\python37\Include\pyaudio'
cwd: C:\Users\Dell\AppData\Local\Temp\pip-install-qm5dhs1u\pyaudio_0fa5615a0f1d45fe897d47e2b712cf51\
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\\Dell\\AppData\\Local\\
Temp\\pip-install-qm5dhs1u\\pyaudio_0fa5615a0f1d45fe897d47e2b712cf51\\setup.py'"'"'; __file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-qm5dhs1u\\pyaud
io_0fa5615a0f1d45fe897d47e2b712cf51\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python37\python.exe' -u -c 'im
port sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Dell\\AppData\\Loca
l\\Temp\\pip-install-qm5dhs1u\\pyaudio_0fa5615a0f1d45fe897d47e2b712cf51\\setup.py
'"'"'; __file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-qm5dhs1u\
\pyaudio_0fa5615a0f1d45fe897d47e2b712cf51\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.cl
ose();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Dell\AppData\Local\Temp\pip-record-mst52wx_\install-record.txt' --single-version-exte
rnally-managed --compile --install-headers 'c:\python37\Include\pyaudio' Check the logs for full command output.
you need to follow these two steps in order to install pyaudio:-
pip install pipwin
pipwin install pyaudio
I hope this resolves your problem.
As the error message says, please install the build tools:
Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools
I made a program that solves this for you. I will put the code in here. It uses the os.system function to do the CMD stuff for you, just an easier way to download it.
import os
os.system('cmd /k "pip install pipwin"')
os.system('cmd /k "pipwin install PyAudio"')
Then run that and it will do it all for you, if it doesn't work on the first try, just run it again. Sometimes it has to restart CMD for pipwin to start working
This question already has answers here:
Error "Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)"
(36 answers)
Pip error: Microsoft Visual C++ 14.0 is required
(13 answers)
Closed 1 year ago.
I want to install Twint with:
pip install twint
But it failed and generating this error:
ERROR: Command errored out with exit status 1:
command: 'c:\users\ramda\appdata\local\programs\python\python39\python.exe' -u
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\setup.py'"'"';
__file__='"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\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\ramda\AppData\Local\Temp\pip-record-itnmxqui\install-record.txt'
--single-version-externally-managed --compile --install-headers 'c:\users\ramda\appdata\local\programs\python\python39\Include\pycares'
cwd: C:\Users\ramda\AppData\Local\Temp\pip-install-lbx86gde\pycares\
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\pycares
copying src\pycares\errno.py -> build\lib.win-amd64-3.9\pycares
copying src\pycares\utils.py -> build\lib.win-amd64-3.9\pycares
copying src\pycares\_version.py -> build\lib.win-amd64-3.9\pycares
copying src\pycares\__init__.py -> build\lib.win-amd64-3.9\pycares
copying src\pycares\__main__.py -> build\lib.win-amd64-3.9\pycares
running build_ext
generating cffi module 'build\\temp.win-amd64-3.9\\Release\\_cares.c'
creating build\temp.win-amd64-3.9
creating build\temp.win-amd64-3.9\Release
building '_cares' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\users\ramda\appdata\local\programs\python\python39\python.exe' -u
-c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\setup.py'"'"';
__file__='"'"'C:\\Users\\ramda\\AppData\\Local\\Temp\\pip-install-lbx86gde\\pycares\\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\ramda\AppData\Local\Temp\pip-record-itnmxqui\install-record.txt'
--single-version-externally-managed --compile --install-headers 'c:\users\ramda\appdata\local\programs\python\python39\Include\pycares' Check the logs for full command output.
It said:
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools
But I already have Microsoft Visual C++ 14.* in my machine. In fact that when I tried to install it again, it says "it has already installed on your machine" or something similar like that.
I've tried a lot of ways that are written in this SO discussion. But no one works for me.
Download and install Microsoft Visual Studio build tools from https://visualstudio.microsoft.com/en/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
Reboot your computer
Upgrade pip with command python -m pip install --upgrade pip
Run your command python -m pip install twint to install the package
Upgrade your pip with: python -m pip install --upgrade pip
Upgrade your wheel with: pip install --upgrade wheel
Upgrade your setuptools with: pip install --upgrade setuptools
Close the terminal and try installing the package again.
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.
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"