Maaz Shaikh
Maaz Shaikh

Reputation: 21

How to install pyaudio module in the current version of python while having multiple versions of python installed?

I have installed multiple versions of python like 3.8.5 and 3.9.2 in my Linux Ubuntu system. I want to install pyaudio module in 3.9.2 version.
For this, I have used a command: pip3 install PyAudio and I am getting this error - error: Microsoft Visual C++ 14.0 is required.

I have also used python unofficial libraries and tried to install pyaudio but it shows this error -
ERROR: PyAudio-0.2.11-cp39-cp39-win_amd64.whl is not a supported wheel on this platform.

Then I used these commands for the same -

After this when I import pyaudio module, it shows module not found error. But when I tried to re-install the module, it shows requirement already satisfied.

Then I executed the command:

Now it shows no error. It seems that pyaudio module has been installed in python 3.8.5 version and not in python 3.9.2 version. However, I used virtual environment of older python version and installed speech recognition, pyaudio which worked well.

I want to use pyaudio module without using virtual environment without any errors. Please help.

Here is the screenshot of the issue
image_pyaudio_issue
Here is the code -
maaz@maaz-HP-Notebook:~$ python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import pyaudio
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pyaudio
import PyAudio
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named PyAudio
exit()
maaz@maaz-HP-Notebook:~$ sudo pip install pyaudio
[sudo] password for maaz:
Requirement already satisfied: pyaudio in /usr/lib/python3/dist-packages (0.2.11)

maaz@maaz-HP-Notebook:~$ sudo -s
[sudo] password for maaz:
root@maaz-HP-Notebook:/home/maaz# python3
Python 3.8.5 (default, May 27 2021, 13:30:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
import pyaudio

exit()
root@maaz-HP-Notebook:/home/maaz# exit
exit

Upvotes: 0

Views: 949

Answers (1)

0x35F093C756
0x35F093C756

Reputation: 359

Check in the usr/bin and usr/local/bin for all python instances.

The installation of python3 is probably linked to python 3.8.5. But there might be a python3.9.

You could check for other python instances in the above folders by running the below commands:

ls -ls /usr/bin/python*
ls -ls /usr/local/bin/python*

If so, you can run the commands with python3.9, but i would recommend cleaning up the unused installations.

Upvotes: 0

Related Questions