0

So I've tied to download PyAudio on PyCharm. When it's downloading I get an error: "Error occurred when installing package 'PyAudio'. Details..." When I click "Details" I get:

Collecting PyAudio
 Using cached PyAudio-0.2.11.tar.gz (37 kB)
 Preparing metadata (setup.py): started
 Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: PyAudio
 Building wheel for PyAudio (setup.py): started
 Building wheel for PyAudio (setup.py): finished with status 'error'
 Running setup.py clean for PyAudio
Failed to build PyAudio
Installing collected packages: PyAudio
 Running setup.py install for PyAudio: started
 Running setup.py install for PyAudio: finished with status 'error'

 error: subprocess-exited-with-error
 
 python setup.py bdist_wheel did not run successfully.
 exit code: 1
 
 [14 lines of output]
 running bdist_wheel
 running build
 running build_py
 creating build
 creating build\lib.win-amd64-3.10
 copying src\pyaudio.py -> build\lib.win-amd64-3.10
 warning: build_py: byte-compiling is disabled, skipping.
 
 running build_ext
 creating build\temp.win-amd64-3.10
 creating build\temp.win-amd64-3.10\Release
 creating build\temp.win-amd64-3.10\Release\src
 cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -IC:\Users\Pirnar\PycharmProjects\pythonProject\venv\include -IC:\Users\Pirnar\AppData\Local\Programs\Python\Python310\include -IC:\Users\Pirnar\AppData\Local\Programs\Python\Python310\Include /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.10\Release\src/_portaudiomodule.obj
 error: command 'cl.exe' failed: None
 [end of output]
 
 note: This error originates from a subprocess, and is likely not a problem with pip.
 ERROR: Failed building wheel for PyAudio
 error: subprocess-exited-with-error
 
 Running setup.py install for PyAudio did not run successfully.
 exit code: 1
 
 [16 lines of output]
 running install
 C:\Users\Pirnar\PycharmProjects\pythonProject\venv\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
   warnings.warn(
 running build
 running build_py
 creating build
 creating build\lib.win-amd64-3.10
 copying src\pyaudio.py -> build\lib.win-amd64-3.10
 warning: build_py: byte-compiling is disabled, skipping.
 
 running build_ext
 creating build\temp.win-amd64-3.10
 creating build\temp.win-amd64-3.10\Release
 creating build\temp.win-amd64-3.10\Release\src
 cl.exe /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DMS_WIN64=1 -IC:\Users\Pirnar\PycharmProjects\pythonProject\venv\include -IC:\Users\Pirnar\AppData\Local\Programs\Python\Python310\include -IC:\Users\Pirnar\AppData\Local\Programs\Python\Python310\Include /Tcsrc/_portaudiomodule.c /Fobuild\temp.win-amd64-3.10\Release\src/_portaudiomodule.obj
 error: command 'cl.exe' failed: None
 [end of output]
 
 note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

Encountered error while trying to install package.

PyAudio

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

I have tried downloadin it by typing this in to terminal

pip install pipwin
pipwin install pyaudio

Also I have downloaded C++ Build tools.

I am using windows 10 pro, python 3.10 and pycharm community edition 2022.1 What do I do?

Tajca-sus3
  • 43
  • 1
  • 1
  • 4
  • 2
    The package does not come with Windows binaries so `pip` is trying to compile it from source. But, as the log message very clearly explains, you do not have the necessary C compiler installed. Even if you do as the message instructs, and download and install Microsoft C++ Build Tools, compiling from source on Windows is often less than straightforward. An alternative that many Windows users gratefully turn to, is to download an unofficial Windows binary from Christoph Gohlke's site. Just be sure to get the correct binary for your version of Python and hardware architecture. – BoarGules Apr 24 '22 at 18:49
  • Hi. Tnx for the reply but I have alredy tryed this and now I get this messige Processing c:\users\pirnar\downloads\pyaudio-0.2.11-cp310-cp310-win_amd64.whl PyAudio is already installed with the same version as the provided wheel. Use --force-reinstall to force an installation of the wheel. Do I just donwload C++ Builds or??? – Tajca-sus3 Apr 27 '22 at 10:41
  • Well, the log you provided showed a failed install. Now you report a successful install. So did you try `--force-reinstall` as the message suggests? – BoarGules Apr 27 '22 at 10:43
  • So I did and It seyed "Pyaudio installed successfuly" but I still can't install pyaudio package on pycharm. Also have installes C++ Build tools and now I get this error messige: I will update original post becouse It's too long. Note: It is updaited. – Tajca-sus3 Apr 27 '22 at 11:35
  • It is likely that you have two Python installations, and `pip` is installing the module into one of them, but PyCharm is using a different one. Do `pip --version` to see where it is installing to. Then look in your PyCharm project settings (Ctrl-Alt-S, Python Interpreter) to see what installation is set. That screen also shows which modules PyCharm can see. If the installations are not the same, navigate to the `Scripts` subfolder of the installation that PyCharm is using, and issue your `pip` command from there. That will run the right `pip` instance. – BoarGules Apr 27 '22 at 11:48
  • Ok so you are right. They are not the same. I just don't know how to fix that. Can you explain step by step couse I'm new to python and pycharm. Tnx. – Tajca-sus3 Apr 27 '22 at 12:14
  • You've been issuissuing the `pip` command at a Windows console prompt. But if you just type `pip` you get the first `pip.exe` in your `PATH` which is not the one you want. Navigate (using `cd`) to the folder PyCharm expects. Then navigate to its `Scripts` subfolder. There is a different copy of `pip.exe` there. It should be the one you want. Do `pip --version` to make sure. Then install. After that, PyCharm should list the module at Ctrl-Alt-S, Python Interpreter. – BoarGules Apr 27 '22 at 12:52

2 Answers2

0

Check out this link. You will find a solution to your problem. You have too prepare your environment before installation.

russyb
  • 9
  • 2
0

This is a well-known problem and the solution is already in the official docs

Evgen
  • 347
  • 2
  • 17