4

I'm a beginner in python. When I want to install NumPy, I didn't work, and especially when the execution reaches this line "Preparing wheel metadata" and here is the error:

C:\Users\dell>pip install numpy
Defaulting to user installation because normal site-packages is not writeable
Collecting numpy
  Using cached numpy-1.19.2.zip (7.3 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1: 'c:\program files\python39\python.exe' 'c:\program files\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\dell\AppData\Local\Temp\tmphnzlje19' Check the logs for full command output.

Zidan Badr
  • 55
  • 1
  • 8

2 Answers2

5

This pip install command is attempting to build numpy from source. You can see this because a .zip file is being downloaded instead of a wheel .whl file. The .zip file contains the source code. Much of NumPy is written in C and needs to be compiled, but it is likely the case that your computer does not have a compiler installed. A wheel (.whl) file does not need to be compiled -- it includes already compiled code, so you do not need a compiler.

EDIT (December 15, 2020): wheel files are available for version 1.19.4, so one can use pip install numpy with python 3.9.

According to https://pypi.org/project/numpy/#files, there is no wheel file yet for python 3.9, so your options are to build numpy from source, use python 3.8 until a numpy wheel comes out for python 3.9, or use conda, which already distributes numpy for python 3.9.

jkr
  • 17,119
  • 2
  • 42
  • 68
1

Using

py -m pip install numpy

fixed the issue . Didn't realized this small and sweet fix. upgrading the pip didn't solved the issue of failed to build the **.toml project file in my case . I found the difference that it directly build the wheels instead of tar/rar file .The benefit is that wheels file are already pre-compiled files and tar files firstly need to be unzipped and finally compiled.