27

Python 3.10 is released and when I try to install NumPy it gives me this: NumPy 1.21.2 may not yet support Python 3.10.. what should I do?

user202729
  • 3,358
  • 3
  • 25
  • 36
Mohamed Yahya
  • 473
  • 1
  • 4
  • 13
  • 7
    Any reason you can't stick with Python 3.9 for a while longer? – khelwood Oct 05 '21 at 23:51
  • 6
    Wait until they make their library compatible with Python 3.10 changes or use Python 3.9 – Ali Tou Oct 05 '21 at 23:53
  • 2
    nope, but I hoped there was a solution – Mohamed Yahya Oct 05 '21 at 23:54
  • 6
    There is the simplest possible solution: wait a while. – khelwood Oct 05 '21 at 23:55
  • Looks like same question as [python - I was trying to install matplotlib but I'm getting this long error - Stack Overflow](https://stackoverflow.com/questions/69450482/i-was-trying-to-install-matplotlib-but-im-getting-this-long-error) (although this one is better) – user202729 Oct 06 '21 at 00:01
  • @khelwood if there is a solution please tell me and if there isn't, is there a way to restore my libs I installed in python 3.9 -which I deleted yesterday- when I reinstall python 3.9 – Mohamed Yahya Oct 06 '21 at 00:22
  • @user202729 actually the problem isn't in matplotlib....the problem is that matplotlib needs numpy – Mohamed Yahya Oct 06 '21 at 00:23
  • 2
    @MohamedYahya That's exactly what I'm saying, the root cause of both question is the same – user202729 Oct 06 '21 at 00:24
  • 2
    Read the latest release notes:https://github.com/numpy/numpy/releases/tag/v1.21.2 – hpaulj Oct 06 '21 at 02:30
  • In your opinion, how long will it take to work on python 3.10? does it worth downgrading? as you see I'm still a beginner – Mohamed Yahya Oct 06 '21 at 02:40
  • A relevant github link, https://github.com/numpy/numpy/pull/20040 – hpaulj Oct 06 '21 at 04:39
  • Just try it, if it works for you, use it :) – Dima Tisnek Oct 06 '21 at 05:57
  • today I got email from newsletter [Python Weekly](https://www.pythonweekly.com/) and there was link to artickle [Why you can’t switch to Python 3.10 just yet](https://pythonspeed.com/articles/switch-python-3.10/) – furas Oct 06 '21 at 17:39
  • 2
    Strange. I installed numpy 1.21.2 without problems quite a while ago (when it came out) on top of one of the python 3.10.0 betas (on Windows). Previous numpy versions couldn't be installed. Right now, scipy is the one I'm waiting for. – Ovaflo Oct 17 '21 at 11:17

4 Answers4

23

If on Windows, numpy has not yet released a precompiled wheel for Python 3.10. However you can try the unofficial wheels available at https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy . Specifically look for

  • numpy‑1.21.2+mkl‑cp310‑cp310‑win_amd64.whl or
  • numpy‑1.21.2+mkl‑cp310‑cp310‑win32.whl

depending on you system architecture.

After downloading the file go to the download directory and run pip install "<filename>.whl".)

(I have personally installed numpy‑1.21.2+mkl‑cp310‑cp310‑win_amd64.whl and it worked for me.)

AXO
  • 8,198
  • 6
  • 62
  • 63
9

Since you are on MS-Windows you can also make use of pipwin - this windows only utility is pip installable and can download and install a number of "unofficial" builds (provided by the excellent Christoph Gohlke) of scientific from the https://www.lfd.uci.edu/~gohlke/pythonlibs/ but takes the guesswork out of which file(s) to download and install.

A session might run:

pip install pipwin
pipwin install numpy

Alternatively you could use the py launcher as in:

py -3.10 -mpip install pipwin
py -3.10 -mpipwin refresh
py -3.10 -mpipwin install numpy

The middle step tells pipwin to populate its list of what is currently available.

Steve Barnes
  • 27,618
  • 6
  • 63
  • 73
  • 2
    pipwin is Windows only, you should note that (in case it's not obvious from the name…) Unfortunately SO's suggested edit queue is full so I can't edit that in myself. – Caesar Oct 31 '21 at 16:04
  • @Caesar - Edited to make it clearer that it is Windows only. – Steve Barnes Nov 02 '21 at 06:26
0

If you don't mind using Docker and Debian, the official python:3.10 (==python:3.10-bullseye) docker container has pip pre-installed. And some packages like numpy can be installed using pip install and run under python 3.10 (good luck with other packages though:).

Here's some PoC and proof that numpy really works there:

$ docker run -it --rm --name python310 -u 0 python:3.10 bash -c 'pip --version; pip install numpy --user --no-cache; pip show numpy; python -c "import numpy as np; print(np.ones(5))"'

..which should output:

pip 21.2.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
Collecting numpy
  Downloading numpy-1.21.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB)
     |████████████████████████████████| 15.9 MB 36.9 MB/s 
Installing collected packages: numpy
  WARNING: The scripts f2py, f2py3 and f2py3.10 are installed in '/root/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.21.4
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: You are using pip version 21.2.4; however, version 21.3.1 is available.
You should consider upgrading via the '/usr/local/bin/python -m pip install --upgrade pip' command.
Name: numpy
Version: 1.21.4
Summary: NumPy is the fundamental package for array computing with Python.
Home-page: https://www.numpy.org
Author: Travis E. Oliphant et al.
Author-email: 
License: BSD
Location: /root/.local/lib/python3.10/site-packages
Requires: 
Required-by: 
[1. 1. 1. 1. 1.]
mirekphd
  • 4,799
  • 3
  • 38
  • 59
0

I use Ubuntu and I had the same issue but when changed the version from 1.19.5 to 1.22.1 my issue fixed

Abbas Jafari
  • 1,492
  • 2
  • 16
  • 28