how can I solve the error of installing pyaudio? [duplicate] - python

This question already has answers here:
How to install pyaudio on mac using Python 3?
(10 answers)
Closed 28 days ago.
I am installing different python libraries for my voice assistant project. I installed "speechrecognization" but I am not able to add pyaudio.
I got an error stating that
ERROR: Failed building wheel for PyAudio", Collecting PyAudio
Using cached PyAudio-0.2.13.tar.gz (46 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: PyAudio
Building wheel for PyAudio (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for PyAudio (pyproject.toml) did not run successfully.
│ exit code: 1
and
Could not build wheels for PyAudio, which is required to install pyproject.toml-based projects
I tried upgrading pip
pip install --upgrade pip
also,
sudo apt install build-essential portaudio19-dev python3.10-dev
pip install pyaudio
brew install portaudio
brew link --overwrite portaudio
pip install pyaudio
python -m pip install PyAudio
pip install PyAudio --upgrade
OS: Mac M1 chip
Python 3.10.2

I tried installing PyAudio using Homebrew and it worked
use the following command:
brew install portaudio
pip install pyaudio
This will first install the portaudio library using Homebrew, and then use pip to install PyAudio, which is a Python wrapper for portaudio.

From the PyAudio project page;
"PyAudio provides Python bindings for PortAudio v19, the cross-platform audio I/O library. With PyAudio, you can easily use Python to play and record audio on a variety of platforms, such as GNU/Linux, Microsoft Windows, and Apple macOS." https://people.csail.mit.edu/hubert/pyaudio/
The project page does in fact state that this python module creates bindings to the PortAudio api. The author lists the steps necessary to install on macOS as being 1) use homebrew to install PortAudio 2) use pip to install PyAudio module. I was able to verify personally that these steps work as of MacOS 13.0.1 on Intel based macbook pro.
*Installing Homebrew via terminal; /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)
*Then installing PortAudio via brew; brew install portaudio
*and finally; pip3 install pyaudio

Related

Unable To Run AzureML Experiment with SDK - Failed to Build Wheel for pynacl / Exit status:1

I am trying to run a AzureML Experiment using sdk (following a Udemy course). When I try to use the Experiment.submit function the experiment prepares and then fails with the following error messages:
ERROR: Command errored out with exit status 1
ERROR: Failed building wheel for pynacl
ERROR: Could not build wheels for pynacl which use PEP 517 and cannot be installed directly
The Azure env as created within my anaconda navigator for a short period of time and then gets removed.
Does anyone know how I can get around this? Any help would be really appreciated.
To resolve ERROR: Could not build wheels for pynacl which use PEP 517 and cannot be installed directly this error, try either of the following ways:
Install missing dependencies:
sudo apt install libpython3-dev build-essential
Upgrade pip:
pip3 install --upgrade pip
Upgrade pip with setuptools wheel:
pip3 install --upgrade pip setuptools wheel
Reinstall PEP517:
pip3 install p5py
pip3 install PEP517
You can refer to ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly, Could not build wheels for _ which use PEP 517 and cannot be installed directly - Easy Solution and failed building wheel for pynacl

pip install ecapture creates an error. How do I solve this?

I cannot install ecapture 0.1.8
Python version: 3.9.6
pip: 21.2.2
I am using Windows 10
I typed pip install ecapture
and got a whole bunch of collecting and installing messages, then this.:
ERROR: Failed building wheel for scikit-image
Failed to build scikit-image
ERROR: Could not build wheels for scikit-image which use PEP 517 and cannot be installed directly
I also tried installing scikit-image and wheel individually but that didn't work. Does anyone know how to help?
I used pip3 install ecapture --no-binary :all: and installed ecapture version 0.0.8 instead of 0.1.8
1 upload from https://pypi.org/project/ecapture/#files
2 download ecapture-0.1.8-py3-none-any.whl
3 open cmd go to download directory cd C:\Users\me\Downloads (in my PC)
4 pip install ecapture-0.1.8-py3-none-any.whl

Building wheel for neural-renderer (setup.py) ... error [duplicate]

This is a truly popular question here at SO, but none of the many answers I have looked at, clearly explain what this error really mean, and why it occurs.
One source of confusion, is that when (for example) you do pip install pycparser, you first get the error:
Failed building wheel for pycparser
which is then followed by the message that the package was:
Successfully installed pycparser-2.19.
# pip3 install pycparser
Collecting pycparser
Using cached https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz
Building wheels for collected packages: pycparser
Running setup.py bdist_wheel for pycparser ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-g_v28hpp/pycparser/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-__w_f6p0 --python-tag cp36:
Traceback (most recent call last):
File "<string>", line 1, in <module>
...
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2349, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
ModuleNotFoundError: No module named 'wheel.bdist_wheel'
----------------------------------------
Failed building wheel for pycparser
Running setup.py clean for pycparser
Failed to build pycparser
Installing collected packages: pycparser
Running setup.py install for pycparser ... done
Successfully installed pycparser-2.19
What is going on here?
(I would like to understand how something can fail but still get installed and whether you can trust this package functioning correctly?)
So far the best partial explanation I have found is this.
(pip maintainer here!)
For a quick copy paste:
pip install wheel
Do that in every new virtual environment created with venv.
Read on for the details and explaination.
If the package is not a wheel, pip tries to build a wheel for it (via setup.py bdist_wheel). If that fails for any reason (like, missing system level libraries, incompatibilities with your system, bad version string in the built wheel, etc), you get the "Failed building wheel for {...}" message.
In some of these cases, currently, pip falls back to installing via setup.py install, so it's possible that the installation still succeeds. That said, pip always tries to install packages via wheels as often as it can. This is because of various advantages of using wheels (like faster installs, cache-able, not executing code again etc) and the fact that it is a standardizd format; unlike the (deprecated) setup.py install interface.
Your error message here is due to the wheel package being missing, which contains the logic required to build the wheels in setup.py bdist_wheel. (pip install wheel can fix that -- but it won't fix any build time issues due to system configuration)
Sometime in the future, we'll switch to a more modern build system by default (if you're a package author, you can opt-in by adding a pyproject.toml) that will solve this issue, through isolated build environments where you will have wheel installed. :)
PEP 517: A build-system independent format for source trees
A blog post on "PEP 517 and 518 in Plain English"
Yesterday, I got the same error: Failed building wheel for hddfancontrol when I ran pip3 install hddfancontrol. The result was Failed to build hddfancontrol. The cause was error: invalid command 'bdist_wheel' and Running setup.py bdist_wheel for hddfancontrol ... error. The error was fixed by running the following:
pip3 install wheel
(From here.)
Alternatively, the "wheel" can be downloaded directly from here. When downloaded, it can be installed by running the following:
pip3 install "/the/file_path/to/wheel-0.32.3-py2.py3-none-any.whl"
Since, nobody seem to mention this apart myself. My own solution to the above problem is most often to make sure to disable the cached copy by using: pip install <package> --no-cache-dir.
In my case, update the pip versión after create the venv, this update pip from 9.0.1 to 20.3.1
python3 -m venv env/python
source env/python/bin/activate
pip3 install pip --upgrade
But, the message was...
Using legacy 'setup.py install' for django-avatar, since package 'wheel' is not installed.
Then, I install wheel package after update pip
python3 -m venv env/python
source env/python/bin/activate
pip3 install --upgrade pip
pip3 install wheel
And the message was...
Building wheel for django-avatar (setup.py): started
default: Building wheel for django-avatar (setup.py): finished with status 'done'
It might be helpful to address this question from a package deployment perspective.
There are many tutorials out there that explain how to publish a package to PyPi. Below are a couple I have used;
medium
real python
My experience is that most of these tutorials only have you use the .tar of the source, not a wheel. Thus, when installing packages created using these tutorials, I've received the "Failed to build wheel" error.
I later found the link on PyPi to the Python Software Foundation's docs PSF Docs. I discovered that their setup and build process is slightly different, and does indeed included building a wheel file.
After using the officially documented method, I no longer received the error when installing my packages.
So, the error might simply be a matter of how the developer packaged and deployed the project. None of us were born knowing how to use PyPi, and if they happened upon the wrong tutorial -- well, you can fill in the blanks.
I'm sure that is not the only reason for the error, but I'm willing to bet that is a major reason for it.
Error :
System : aws ec2 instance (t2 small)
issue : while installing opencv python via
pip3 install opencv-python
Problem with the CMake installation, aborting build. CMake executable is cmake
----------------------------------------
Failed building wheel for opencv-python
Running setup.py clean for opencv-python
What worked for me
pip3 install --upgrade pip setuptools wheel
After this you still might received fallowing error error
from .cv2 import *
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
Installing libgl solved the error for me.
sudo apt update
sudo apt install libgl1-mesa-glx
Hope this helps
This error mostly comes up when you do not have the required packages needed by wheel.
If you are using python3, then install python3-dev or python2-dev if you are using python 2.
sudo apt-get install python3-dev
or
sudo apt-get install python2-dev
Try this:
sudo apt-get install libpcap-dev libpq-dev
It has worked for me when I have installed these two.
See the link here for more information
On Ubuntu 18.04, I ran into this issue because the apt package for wheel does not include the wheel command. I think pip tries to import the wheel python package, and if that succeeds assumes that the wheel command is also available. Ubuntu breaks that assumption.
The apt python3 code package is named python3-wheel. This is installed automatically because python3-pip recommends it.
The apt python3 wheel command package is named python-wheel-common. Installing this too fixes the "failed building wheel" errors for me.
I got the same message when I tried to install
pip install django-imagekit.
So I ran
pip install wheel
(I had python 2.7) and then I reran pip install django-imagekit and it worked.
I had the same problem while installing Brotli
ERROR
Failed building wheel for Brotli
I solved it by downloading the .whl file from here
and installing it using the below command
C:\Users\{user_name}\Downloads>pip install Brotli-1.0.9-cp39-cp39-win_amd64.whl
I stuck with this problem for several hours when I was trying to install a package that requires 'isal', but isal installation failed:
----------------------------------------
ERROR: Failed building wheel for isal
Failed to build isal
ERROR: Could not build wheels for isal which use PEP 517 and cannot be installed directly
The solution that works for me is installing libtool.
yum install libtool
I would like to add that if you only have Python3 on your system then you need to start using pip3 instead of pip.
You can install pip3 using the following command;
sudo apt install python3-pip -y
After this you can try to install the package you need with;
sudo pip3 install <package>
I was trying to install python-nmap tool, and getting this error.
If you are on Linux platform, please make sure that the nmap tool is installed, otherwise the library python-nmap won't work.
On Red Hat based distribution, please install nmap CLI as follow:
sudo yum install namp
This may Help you ! ....
Uninstalling pycparser:
pip uninstall pycparser
Reinstall pycparser:
pip install pycparser
I got same error while installing termcolor and I fixed it by reinstalling it .

python-Levenshtein library install error on MacOS

I am trying to install a package on a python project but having some issues with python-Levenshtein library. I'm using a virtual environment on PyCharm which is running with Python3.8 and installed all libraries in requirements.txt with pip. However I am not able to install this library.
What I've tried so far:
try to install with pip and pip3
try to install with anaconda
try to install with brew (to make sure it's not like matplotlib here)
I share the error message below. Could you help me to solve this problem
Collecting python-Levenshtein==0.12.0
Using cached python-Levenshtein-0.12.0.tar.gz (48 kB)
Requirement already satisfied: setuptools in /Users/suleyman/Projects/venv/lib/python3.8/site-packages (from python-Levenshtein==0.12.0) (51.1.1)
Building wheels for collected packages: python-Levenshtein
Building wheel for python-Levenshtein (setup.py): started
Building wheel for python-Levenshtein (setup.py): finished with status 'error'
Running setup.py clean for python-Levenshtein
Failed to build python-Levenshtein
Installing collected packages: python-Levenshtein
Running setup.py install for python-Levenshtein: started
Running setup.py install for python-Levenshtein: finished with status 'error'
ERROR: Command errored out with exit status 1:
You can just do python3 -m pip install python-levenshtein or if you want to install system-wide just do the sudo -H python3 -m pip install python-levenshtein.
P.S. It works for me.
I've found the solution and explain it for those who suffers from the same thing. Macbook comes with its own python in usr/bin/python and user/bin/python3 and first I used them as base interpreter however I faced that issue. I think default pythons don't include some essentials.
The solution is installing your python and giving its path as the base interpreter. After that pip is able to install the library.
That solved my issue and I am able to install my libraries.
Try installing libpython3.8-dev (see this post)
I was running into the same build error on Ubuntu 18.04 until I ran
sudo apt install libpython3.8-dev
Then, inside my python virtual environment, I ran
python3 -m pip install python-Levenshtein
If that doesn't work, check that you have build-essential installed. If not, then try:
sudo apt install build-essential

Problem when installing google-cloud-speech python API in raspberry pi 3 (Jessie) via pip

I'm trying to install the google-cloud-speech python API for raspberry pi 3 (raspbian Jessie) using pip (1.5.6). I follow the instructions given by:
https://cloud.google.com/speech-to-text/docs/reference/libraries?authuser=1#client-libraries-install-python
but when installing the library using pip:
pip install --upgrade google-cloud-speech
I get this error:
error in grpcio setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers
and the installation doesn't finish. The same job worked for me some months ago, so I guess some changes was made. Any ideas?
I've already tried upgrading pip
Start with upgrading installation tools:
pip install --upgrade setuptools pip
Upgrade your setup tools/ pip
pip install setuptools -U
Thank you all! now it is working. I'm pretty sure I tried before one of:
pip install --upgrade setuptools pip
pip install setuptools -U
But the thing is that executing both of them the installation finished correctly.

Categories

Resources