45

I`m using python poetry(https://python-poetry.org/) for dependency management in my project.

Though when I`m running poetry install, its giving me below error.

ERROR: Failed building wheel for numpy
  Failed to build numpy
  ERROR: Could not build wheels for numpy, which is required to install pyproject.toml-based projects

I`m having python 3.9 installed in my laptop.
I installed numpy 1.21.5 using pip install numpy, I even tried to down version it to 1.19.5.

Though I`m getting the same error.

I found out many people are getting ERROR: Failed building wheel for numpy this error in python 3.10, they solved it by down versioning python to 3.9, though that didnt working for me.

Lakshay Rohilla
  • 1,654
  • 6
  • 9
  • 30

4 Answers4

10

I solved it by doing the following steps:-

  1. I updated the pyproject.toml(This file contains all the library/dependency/dev dependency)with the numpy version that I installed using pip install numpy command. enter image description here

  2. Run poetry lock to update poetry.lock file(contains details information about the library) enter image description here

  3. Run poetry install again, & it should work fine.

  • In a nutshell, you just have to install the correct version of numpy Click me to check the compatibility
  • And then install the required version using pip install numpy==version.
    Example: To install NumPy version 1.23.5, use the following- pip install numpy==1.23.5

If you are having any problems, you can comment. I`ll try to answer it.

Lakshay Rohilla
  • 1,654
  • 6
  • 9
  • 30
  • This worked for me as well. The error came with numpy version 1.21.2 but not with 1.22.3. Please consider, that newer numpy versions, e.g. 1.22.3 requires Python 3.8 or newer. I had to update my pyproject.toml to respect this as well. – ediordna Apr 05 '22 at 11:07
  • 1
    Where should this pyproject.toml file be located? As I can't find it... – Nelis Dec 12 '22 at 15:27
  • 1
    @Nelis, It's in the root directory. – Lakshay Rohilla Dec 12 '22 at 17:13
3

I had this trying to install numpy with PyPy on macOS.

I solved the issue by first running brew doctor, which showed that my Command Line Tools (XCode) were outdated. Then I just followed the instructions to update them:

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

This solved the issue.


My configuration:

  • macOS 12.2.1 Monterey
> python --version
Python 3.8.12 (9ef55f6fc369, Oct 25 2021, 05:10:01)
[PyPy 7.3.7 with GCC Apple LLVM 13.0.0 (clang-1300.0.29.3)]
Kurt Bourbaki
  • 11,984
  • 6
  • 35
  • 53
0

I solved the problem by install the right version of numpy check the compatibility here https://matplotlib.org/stable/devel/min_dep_policy.html

and then install it by pip3 install -v numpy==[version]

-4

Numpy error solved

Error: failed to build wheels for numpy which is required to install project.tmol

This error cause due to outdated numpy version simply run this command

MATHLAB = "m" pip install numpy

`

My python version: Python -V=3.9

It doesn't works in se case but most of the time works.

If you are working in venvthen try to install numpy in venv. Then run your code it will be working Fine.

ANDREW
  • 1
  • 1