I am writing a program in Python on RaspberryPi, But I am getting an error
ImportError No module named pyaudio
After that I tried
git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
but again get another
fatal: destination path 'pyaudio' already exists and is not an empty directory.
Can you please guide me that how do I install PyAudio in RaspberryPi
Remove the directory PyAudio which already presen in /home/pi and then try these steps
sudo apt-get install git
sudo git clone http://people.csail.mit.edu/hubert/git/pyaudio.git
sudo apt-get install libportaudio0 libportaudio2 libportaudiocpp0 portaudio19-dev
sudo apt-get install python-dev
cd pyaudio
sudo python setup.py install
or also you can try this
sudo apt-get install python-pyaudio
let us know if u need more assistance or any other trouble
If
sudo apt-get install python-pyaudio
did’t work try:
sudo apt-get install python3-pyaudio
You can simply install PyAudio by executing this command:
pip install pipwin
pipwin install pyaudio
python -m pip install pyaudio
This command works if you already have pip installed.
If not, first install pip and ty
download suitable version of PyAudio File: https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
Then Open CMD
type : C:\Users\Programs\Python\Python37\Scripts add "pip install"
file location where you download the PyAudio whl file add File name
example:C:\Users\Programs\Python\Python37\Scripts>pip install C:\Users\Desktop\Projects\PyAudio-0.2.11-cp37-cp37m-win_amd64.whl
Install using below command
conda install -c anaconda pyaudio
This command worked for me:
conda install -c anaconda pyaudio
pip install pyaudio
this worked for me,hope it helps you too.
Related
I tried a lot of things to install PyAudio on my PC for example:
pip istall PyAudio
but it says:
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Tools\\MSVC\\14.26.28801\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2
I also tried pipwin install PyAudio and pip install PyAudio-0.2.11-cp38-cp38-win_amd64.whl
but it says PyAudio-0.2.11-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
What should I do?
Following this link https://www.codegrepper.com/code-examples/python/install+pyaudio+pip3+ubuntu ;
For Windows:
pip install pipwin
then
pipwin install pyaudio
For Linux (Ubuntu)
sudo apt-get install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0
pip install pyaudio --user
Pyaudio is not compatible with Python 3.8. 3.7 and below work with Pyaudio. For more information, visit this similar post. PyAudio package not installing
This is for Python 2.7
sudo apt-get install python-pyaudio
This is for Python 3x
sudo apt-get install python3-pyaudio
This will solve ASAP!
I'm trying to install modules such as gitpython into my Python3 directory however when I run:
Pip install gitpython it automatically downloads it into python2.7
I've tried specify the Python3 directory but it says the the library has already been installed.
Requirement already satisfied: gitpython in /usr/local/lib/python2.7/dist-packages (2.1.11)
Problem is when I try to call from git import repo my Python3 can't find the module.
Is there anyway to get pip to install my libraries to Python3 as a default, can I just uninstall Python 2.7 to save problems?
I run
sudo apt install python3-pip
and it states it is already installed, so I run sudo pip3 install gitpython and it says Command 'pip3' not found, but can be installed with:
sudo apt install python3-pip
SOLUTION
sudo apt-get remove python3-pip; sudo apt-get install python3-pip
It depends of your version of pip. But I think that python3-pip may do the trick.
sudo apt-get install python3-pip
sudo pip3 install MODULE_NAME
You should use pip3 to install your packages in your python3 environment. thus instead of installing with pip use pip3 install gitpython
You can try to see the version of python with:
python --version
if the result is python 2.7, that means that your environment variable for python3 needs to be set.
After that you can try:
python -m pip install package_name
I hope it will help you =)
Adrien
You should use python3 venv Python 3 venv
python3 -m venv /path/virtual/environment
source /path/virtual/environment/bin/activate
or use pip3 to installing any libraries for python 3
$ pip3 install 'some library'
You should create virtual environment for python3. using:
virtualenv -p /usr/bin/python3 <VIRTUAL_ENV NAME>
Then activate it using:
source <VIRTUAL_ENV NAME>/bin/activate
Then install your dependency(gitpython in your case) into that.
I've had to install Python packages and libraries using pip, but every time I do, it says I'm using an older version of pip, and that v18.1 is available by running the command
python -m pip install --upgrade pip
When I run this command, it just says the same thing. It apparently can't update itself because it's outdated. Is there any way to get around this, maybe by manually updating it?
Thanks in advance, community!
Update: The OS I'm using is currently Windows 10 and Python 3.6.4. The following screenshot is what outputs when running the command.
Upgrading pip
On Linux or macOS:
pip install -U pip
On Windows:
python -m pip install -U pip
Try with "python -m pip install --upgrade pip --user"
It worked with me and I am with Win10.
If you are on linux try this -
sudo su root
apt-get purge -y python-pip
wget https://bootstrap.pypa.io/get-pip.py
python ./get-pip.py
apt-get install python-pip
or
sudo -H pip3 install --upgrade pip
sudo -H pip2 install --upgrade pip
On OS X this worked for me
python -m pip install --upgrade pip
I am trying to install scrapy-deltafetch on ubuntu 14 using pip (v8.1.2 on python 2.7). When I run (sudo) pip install scrapy-deltafetch, I get the following error:
Update:
Complete output from command python setup.py egg_info:
Can't find a local Berkeley DB installation.
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-TVr3UZ/bsddb3/
Any thoughts on how to resolve this?
I have already ran the following:
sudo python ez_setup.py
pip install --upgrade setuptools
as well as
sudo apt-get install python-setuptools
I do have both python3 and python 2.7 on the computer.
I have tried installing bsdb3 but that does not work either. I will look into setting up berkeley db correctly and update here accordingly
Update:
Installing berkeley DB did not solve the issue.
scrapy-deltafetch requires bsddb3.
bsddb3 itself, on Ubuntu Trusty, depends on libdb5.3.
You can either install python-bsddb3 with apt-get, or only apt-get install libdb5.3. pip install scrapy-deltafetch should work after that.
Install libbd-dev first,
sudo apt-get install libdb-dev
then install deltafetch,
# for python2
sudo -H pip install scrapy-deltafetch
# for python3
sudo -H pip3 install scrapy-deltafetch
I'm using mac osx 10.10
As the PyAudio Homepage said, I install the PyAudio using
brew install portaudio
pip install pyaudio
the installation of portaudio seems successful, I can find headers and libs in /usr/local/include and /usr/local/lib
but when I try to install pyaudio, it gives me an error that
src/_portaudiomodule.c:29:10: fatal error: 'portaudio.h' file not found
#include "portaudio.h"
^
1 error generated.
error: command 'cc' failed with exit status 1
actually it is in /usr/local/include
why can't it find the file?
some answers to similar questions are not working for me(like using virtualenv, or compile it manually), and I want to find a simple way to solve this.
Since pyAudio has portAudio as a dependency, you first have to install portaudio.
brew install portaudio
Then try: pip install pyAudio. If the problem persists after installing portAudio, you can specify the directory path where the compiler will be able to find the source programs (e.g: portaudio.h). Since the headers should be in the /usr/local/include directory:
pip install --global-option='build_ext' --global-option='-I/usr/local/include' --global-option='-L/usr/local/lib' pyaudio
On Ubuntu builds:
sudo apt-get install python-pyaudio
For Python3:
sudo apt-get install python3-pyaudio
You have to install portaudio first then link that file. Only then you can find that header file (i.e, portaudio.h). To install portaudio in mac by using HomeBrew program use following commands.
brew install portaudio
brew link portaudio
pip install pyaudio
sudo is not needed if you're admin. We should refrain using sudo as it messes up lots of permissions.
First, you can use Homebrew to install portaudio.
brew install portaudio
Then try to find the portaudio path:
sudo find / -name "portaudio.h"
In my case it is at /usr/local/Cellar/portaudio/19.6.0/include .
Run the command below to install pyaudio
pip install --global-option='build_ext' --global-option='-I/usr/local/Cellar/portaudio/19.6.0/include' --global-option='-L/usr/local/Cellar/portaudio/19.6.0/lib' pyaudio
On Raspbian:
sudo apt-get install python-pyaudio
on Centos:
yum install -y portaudio portaudio-devel && pip install pyaudio
Just for the record for folks using MacPorts and not Homebrew:
$ [sudo] port install portaudio
$ pip install pyaudio --global-option="build_ext" --global-option="-I/opt/local/include" --global-option="-L/opt/local/lib"
I needed to do the following to install PortAudio on Debian
sudo apt install portaudio19-dev
I also apt install'd python3-portaudio before that, although it didn't work. I'm not sure if that contributed as well.
Adding a bit of robustness (in case of a non-default homebrew dir) to the snippet from #fukudama,
brew install portaudio
pip install --global-option='build_ext' --global-option="-I$(brew --prefix)/include" --global-option="-L$(brew --prefix)/lib" pyaudio
For me on 10.10.5 the paths were under /opt/local. I had to add /opt/local/bin to my /etc/paths file. And the command line that worked was
sudo pip install --global-option='build_ext' --global-option='-I/opt/local/include' --global-option='-L/opt/local/lib' pyaudio
this is the tested answer for MacBook Pro m2 chip:
first find the location of the portaudio.h file by
sudo find / -name "portaudio.h"
then, once you find the location, copy it and use it in this command.
LDFLAGS="-L/{opt/homebrew/Cellar/portaudio/19.7.0/}lib" CFLAGS="-I/{opt/homebrew/Cellar/portaudio/19.7.0}/include" pip3 install pyaudio
Here replace the location from { } into you file location hopefully this works. I have tried above solutions and this one worked for me.
If you are using anaconda/miniconda to manage your python environments then
conda install pyaudio
installs portaudio at the same time as pyaudio
The following NEW packages will be INSTALLED:
portaudio pkgs/main/osx-64::portaudio-19.6.0-h647c56a_4
pyaudio pkgs/main/osx-64::pyaudio-0.2.11-py37h1de35cc_2
On Termux (this is what worked for me):
pkg install python
bash -c "$(curl -fsSL https://its-pointless.github.io/setup-pointless-repo.sh)"
pkg install portaudio
pip install pyaudio
Source: pyaudio installing #6235
For M1 mac, this is worked for me:
LDFLAGS="-L/opt/homebrew/Cellar/portaudio/19.7.0/lib" CFLAGS="-I/opt/homebrew/Cellar/portaudio/19.7.0/include" pip3 install pyaudio
Res:
Created wheel for pyaudio: filename=PyAudio-0.2.12-cp310-cp310-macosx_11_0_arm64.whl size=24170 sha256=c74eb581e6bca2400f681f68d33654002722969f1a455ffce87e4e5da05471d8
Stored in directory: /private/var/folders/m_/kzyr4q_11cl35ngrj77k28f00000gn/T/pip-ephem-wheel-cache-ql1x8ums/wheels/93/08/0b/b915ab1895927641737175e5bc7b6111e8ed0c26daabeecba0
Successfully built pyaudio
Installing collected packages: pyaudio
Successfully installed pyaudio-0.2.12
Be noted, do not using find / its very slow and stupid, using brew info portaudio