TL;DR
--If numpy is via system pip3, pip3 install numpy
will work fine
--I get an error when I do poetry add numpy
via poetry
poetry run pip install numpy
and forcibly throw numpy
via pip3 in the virtual environment created by poetry.poetry add numpy
to make poetry recognize numpy and update pyproject.toml
and poetry.lock
NOTE: This step was performed in your environment on January 20, 2021.
If you look at https://github.com/numpy/numpy/issues/17987#issuecomment-75202322
You can use the 1.20.0rc2 release candidate.
python -m pip install -i https://pypi.anaconda.org/multibuild-wheels-staging/simple numpy==1.20.0rc2
This should become the 1.20.0 release in a few weeks.
Since there is a description, try poetry add numpy == 1.20.0rc2
.
However, I got an AssetionError during the build process during installation, so I decided to give up on this path.
According to https://numpy.org/news/, the numpy binaries for Python3.9 are still in preparation as of September 14, 2020. I expected this to be affecting it, and in the Python3.9 environment it was failing because I was trying to build from source code via poetry. I dropped the version to Python 3.8 and tried it.
PYTHON 3.9 IS COMING, WHEN WILL NUMPY RELEASE BINARY WHEELS? Sept 14, 2020 – Python 3.9 will be released in a few weeks. If you are an early adopter of Python versions, you may be dissapointed to find that NumPy (and other binary packages like SciPy) will not have binary wheels ready on the day of the release. It is a major effort to adapt the build infrastructure to a new Python version and it typically takes a few weeks for the packages to appear on PyPI and conda-forge. In preparation for this event, please make sure to
- update your pip to version 20.1 at least to support manylinux2010 and manylinux2014
- use
--only-binary=numpy
or--only-binary=:all:
to prevent pip from trying to build from source.
In conclusion, this prediction was false, and as of January 20, 2021, numpy binaries for Python3.9 were distributed (https://pypi.org/project/numpy/#files).
I wrote the following preconditions at the beginning.
If numpy is via system pip3,
pip3 install numpy
will work fine
Through trial and error, I sometimes tried to install numpy via pip3 instead of poetry, but in my environment, numpy could be installed without any problem if it was via pip3 on the system. If so, I thought it would be impossible to pip numpy in poetry's virtual environment without using poetry. In other words
poetry run pip install numpy
This is what it is. I feel a little unpleasant, but I tried it as a trial.
Then, how can you enter without any problems!
In the above steps, numpy was half-forced into the virtual environment created by poetry. However, the method I just tried is different from the usual library installation method that poetry expects, so poetry does not recognize it as a numpy managed package. Specifically, pyproject.toml
and poetry.lock
have not been updated at all.
So if you hit something like poetry update
at this stage, the" unidentified "numpy will be removed from the virtual environment created by poetry.
So, run poetry add numpy
to let poetry formally install numpy. Since numpy is already installed in the virtual environment created by poetry, the numpy installation will not actually be performed, it will only update the dependency management files.
There was already an example of forcibly solving the situation as described in this article. https://qiita.com/Ryuichirou/items/f769e5072305802e18c5
In the above similar article, it seems that the following steps are taken.
requirements.txt
requirements.txt
installed via pipAuthors of similar articles themselves
Somehow, the feeling of korejanai is amazing. I want to solve it better.
Is saying.
This article provided a simpler, better solution with fewer steps than similar articles.