Failed to install Numpy 1.20.2 with Poetry on Python 3.9 - numpy

When I try to install Numpy 1.20.2 module with Python Poetry 1.1.4 package manager (poetry add numpy) in a Python 3.9.0 virtual environment, I get:
ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which use PEP 517 and cannot be installed directly
I read a few threads like this one, but since then it seems the latest Numpy versions are supposed to be able to be built with 3.9 (see this official Numpy release doc, and this answer).
Did I miss something?
EDIT: using pip 21.0.1 (latest)

Related

Incompatible scipy and numpy versions

I am trying to install a python package "ezLncPred" which requires a numpy version of 1.15 in my python3.8. While installing it tells that this version of numpy is not compatible with my SciPy version of 1.7.3. I have to upgrade it to numpy1.2 for it.
Any idea on how to resolve this issue ?

Install numpy for Python 3.7 in Ubuntu 18.04

I'm having trouble installing numpy on Ubuntu 18.04 for Python 3.7... here's what I tried:
(venv) root#servername:/path$ pip3.7 install numpy --no-cache-dir
Collecting numpy
Downloading numpy-1.19.5-cp37-cp37m-manylinux2010_x86_64.whl (14.8 MB)
|████████████████████████████████| 14.8 MB 8.6 MB/s
Installing collected packages: numpy
Successfully installed numpy-1.19.5
I get this ImportError:
Original error was: No module named 'numpy.core._multiarray_umath'
... but I've been focusing on this as the probable cause, from that same error message:
* The Python version is: Python3.6 from "/path/venv/bin/python"
... that says Python 3.6, but I'm trying to use Python3.7, and that python is on 3.7:
(venv) root#servername:/path$ /path/venv/bin/python --version
Python 3.7.9
I saw in another answer that upgrading can help, so I tried this - it looks like I'm already on the latest:
(venv) root#servername:/path$ pip install numpy --upgrade
Requirement already satisfied: numpy in ./venv/lib/python3.7/site-packages (1.19.5)
How can I get this working?
This was failing for me while using mod-wsgi with Apache - I had to load mod-wsgi for Python 3.7 instead of the system default of 3.6. The instructions are at https://github.com/GrahamDumpleton/mod_wsgi/issues/467, but in case that goes away:
Using your venv, run "mod_wsgi-express module-config"
Put the resulting load command into your apache's mods-enabled/wsgi.load

Pandas incompatible with numpy

I am using anaconda 3. When I try to import pandas I receive the following message:
ImportError: this version of pandas is incompatible with numpy < 1.15.4
your numpy version is 1.15.3.
Please upgrade numpy to >= 1.15.4 to use this pandas version
Printing numpy.__path__ gives me the following
['C:\Users\andrei\AppData\Roaming\Python\Python37\site-packages\numpy']
In conda list, my numpy version is 1.19.1. I checked the above directory to find that it has only numpy 1.15.3 inside and nothing else. Spyder is using this path instead of the anaconda's path to numpy for some arcane reason.
Looks like you have somehow installed several versions of NumPy. Try to remove them all by running several times conda remove numpy and pip uninstall numpy. If you have two versions, the corresponding uninstall command needs to be run twice. After these, install a fresh version of NumPy conda install numpy
You can verify if you still have a version of NumPy installed
conda list | grep numpy
pip list | grep numpy
Note that these commands show only one version number even if you have several copies installed.
You can use conda to upgrade to upgrade your numpy. Run this command in the terminal:
conda update numpy
You need to remove this directory
C:\Users\andrei\AppData\Roaming\Python\
to fix this problem. It seems at some point you used pip to install numpy and that's interfering with the packages installed by conda (which is reporting the right version, as you said).
Furthermore, please be aware that pip and conda packages are binary incompatible, so you should avoid as much as possible to mix them.

How to install numpy on vscode on mac?

It's saying:
"ModuleNotFoundError: No module named 'numpy'"
and then when I do "pip install numpy" it says:
Requirement already satisfied: numpy in ./Library/Python/2.7/lib/python/site-packages (1.16.6)"
Probably you are using python 3.X while pip is configured for python 2.X.
Try running pip3 install numpy
Basically you are installing a package for python 2, while running the script with python 3.

RuntimeError: module compiled against API version a but this version of numpy is 9 in ubuntu

I just installed theano, but
import numpy
print numpy.version
here is the output
Theano version 0.7.0.dev-30cc6380863b08a3a90ecbe083ddfb629a56161d
theano is installed in /home/sizhexi/theano/Theano/theano
NumPy version 1.8.2
NumPy is installed in /usr/lib/python2.7/dist-packages/numpy
Python version 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2]
nose version 1.3.1
RuntimeError: module compiled against API version a but this version of numpy is 9
terminate called after throwing an instance of 'std::runtime_error'
what(): numpy failed to initialize
Aborted (core dumped)
how to solve it?
Package management in python is sometimes tricky. To avoid these issues, I recommend using Anaconda which is a good python package and environment manager (download here, and 30 minutes guide).
Follow the official instructions to install Anaconda and chose the default values that will add Anaconda to your $PATH and make Anaconda your default python interpreter. Then open your terminal and use the following commands :
conda install pip six nose numpy scipy
pip install theano
Then try running your script using anaconda.