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
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
I have an M1 MacBook. I have installed python 3.9.1 using pyenv, and have pip3 version 21.0.1.
I have installed homebrew and hdf5 1.12.0_1 via brew install hdf5.
When I type
pip3 install h5py
I get the error:
Requirement already satisfied: numpy>=1.19.3 in /Users/.../.pyenv/versions/3.9.1/lib/python3.9/site-packages (from h5py) (1.20.0)
Building wheels for collected packages: h5py
Building wheel for h5py (PEP 517) ... error
Loading library to get build settings and version: libhdf5.dylib
error: Unable to load dependency HDF5, make sure HDF5 is installed properly
error: dlopen(libhdf5.dylib, 6): image not found
----------------------------------------
ERROR: Failed building wheel for h5py
I saw that libhdf5.dylib is present in /opt/homebrew/opt/hdf5/lib, so I tried export LDFLAGS="-L/opt/homebrew/opt/hdf5/lib" and export CPPFLAGS="-L/opt/homebrew/opt/hdf5/include" beforehand but they don't help.
How can I install h5py?
I am actually installing h5py as a requirement to install Keras.
Thanks!
This works for me:
$ brew install hdf5
$ export HDF5_DIR="$(brew --prefix hdf5)"
$ pip install --no-binary=h5py h5py
Try to install h5py using conda. Works for me.
conda install h5py
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
I get an error when pip builds wheels for the cryptography package.
Error:
LINK : fatal error LNK1181: cannot open input file 'libssl.lib'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\link.exe' failed with exit status 1181
----------------------------------------
ERROR: Failed building wheel for cryptography
Running setup.py clean for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
I have already installed OpenSSL and set the environment variables as suggested in this post yet the problem persists. My setup details:
System - Windows 10
Python - 3.8
Pip - 19.3.1
In my case (windows 10 + conda) updating pip fixed the problem:
python -m pip install --upgrade pip
Setting cryptography to version 2.8 in requirements.txt fixed the issue.
TLDR;
Try using cryptography==3.1.1
Details:
This happened on Python 3.9.0 on Windows 10 PC.
I had the following in requirements.txt
cryptography==2.8
I removed the version and kept only cryptography in requirements.txt file like below
cryptography
Saved the requirements.txt and then I ran
pip install -r requirements.txt
It installed successfully.
Then I freeze the requirements.txt by running the following command
pip freeze > requirements.txt
Then the requirements.txt got updated with cryptography==3.1.1
Had also this issue. If you're using alpine, make sure that all dependencies for cryptography are installed.
In my case the cargo package was missing and causing the issue.
sudo apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo
https://cryptography.io/en/latest/installation.html#building-cryptography-on-linux
Ran into this issue, and the solution is actually in the message when pip attempts to install openssl before cryptography:
generating cffi module 'build/temp.linux-x86_64-3.7/_openssl.c'
running build_rust
=============================DEBUG ASSISTANCE=============================
If you are seeing a compilation error please try the following steps to
successfully install cryptography:
1) Upgrade to the latest pip and try again. This will fix errors for most
users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
2) Read https://cryptography.io/en/latest/installation.html for specific
instructions for your platform.
3) Check our frequently asked questions for more information:
https://cryptography.io/en/latest/faq.html
4) Ensure you have a recent Rust toolchain installed:
https://cryptography.io/en/latest/installation.html#rust
5) If you are experiencing issues with Rust for *this release only* you may
set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
=============================DEBUG ASSISTANCE=============================
Simply running the pip update command appeared to work for me:
pip install -U pip
Which updated pip from version 18.0 to version 21.0.1
I faced this issue on macOS Monterey (version 12.2.1) Apple M1 Pro. I followed Cryptography installation documentation and it helped me resolve the issue.
brew install openssl#1.1 rust
env CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=1 LDFLAGS="$(brew --prefix openssl#1.1)/lib/libssl.a $(brew --prefix openssl#1.1)/lib/libcrypto.a" CFLAGS="-I$(brew --prefix openssl#1.1)/include" pip3 install cryptography
You can use the lastest version with
python3 -m pip install --no-use-pep517 cryptography
worked for me with ubuntu:18.04 on arm32v7
(instead as suggested by the error message install the full rust compiler and build-essentials, or upgrading pip (what had no effect on ubuntu:18.04 on my armbian))
pip install --upgrade pip
Try to upgrade pip of your environment working fine for me.
I got this error trying to install Scrapy with Python 3.8.1 on Windows 10, but its solved installing the last version of pip (19.3.1 in my case) and all works using pip in this way:
python -m pip install scrapy --user
I have faced same issue and tried to install openssl with mentioned step but still was not able to proceed for windows 10. Later I upgraded pip to latest version and tried again and it worked without any issue.
I would recommend to upgrade pip to latest version and give a try before proceeding for installing openssl
I had the same issue. pip3 version was 19.* after upgrade it works
sudo -H pip3 install --upgrade pip
You can try to install cryptography==3.1.1 package instead of cryptography 35 version.
pip install cryptography==3.1.1
If still you are facing challenges in cryptography package integration.
You can resolve that by the following steps.
python -m pip install --upgrade pip
sudo pip install -U pip setuptools
I had this problem and i just installed rust and problem fixed for me
You can install end version of cryptography after installing rust programming languege(dont try pip install rust, its not python package)
https://www.rust-lang.org/tools/install
Just updating pip
python -m pip install --upgrade pip
I did not install the latest version of Scrapy, then it worked for me. Instead of installing version 2.6.3, I installed 2.6.2:
pip install Scrapy==2.6.2
I use PyCharm 2022.2.3 (Professional Edition) on Windows.