[PYTHON] I couldn't install numpy using poetry on macOS Big Sur, so I forcibly avoided it

environment

Event that occurred

When I did poetry install with the following description in pyproject.toml

[tool.poetry.dependencies]
python = "3.8.*"
pip = "^20.3.3"
gcsfs = "^0.7.1"
lightgbm = "^3.1.1"
pandas = "^1.2.0"
matplotlib = "^3.3.3"
seaborn = "^0.11.1"
% poetry install

Python 2.7 will no longer be supported in the next feature release of Poetry (1.2).
You should consider updating your Python version to a supported one.

Note that you will still be able to manage Python 2.7 projects by using the env command.
See https://python-poetry.org/docs/managing-environments/ for more information.

Installing dependencies from lock file

Package operations: 80 installs, 0 updates, 0 removals

  • Installing lazy-object-proxy (1.4.3)
  • Installing six (1.15.0)
  • Installing wrapt (1.12.1)
  • Installing certifi (2020.12.5)
  • Installing astroid (2.4.1)
  • Installing chardet (3.0.4)
  • Installing idna (2.10)
  • Installing isort (4.3.21)
  • Installing mccabe (0.6.1)
  • Installing pyasn1 (0.4.8)
  • Installing pycodestyle (2.6.0)
  • Installing pyflakes (2.2.0)
  • Installing toml (0.10.2)
  • Installing urllib3 (1.26.2)
  • Installing cachetools (4.2.0)
  • Installing flake8 (3.8.4)
  • Installing multidict (5.1.0)
  • Installing numpy (1.19.5): Failed

EnvCommandError

Workaround

It can be installed using pip 20.3.3 without using poetry (using python 3.9, but also with python 3.8)

% python3.9 -m venv --upgrade-deps venv
Collecting pip
  Downloading pip-20.3.3-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 4.9 MB/s 
Collecting setuptools
  Using cached setuptools-51.1.1-py3-none-any.whl (2.0 MB)
Installing collected packages: pip, setuptools
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
  Attempting uninstall: setuptools
    Found existing installation: setuptools 49.2.1
    Uninstalling setuptools-49.2.1:
      Successfully uninstalled setuptools-49.2.1
Successfully installed pip-20.3.3 setuptools-51.1.1
% source venv/bin/activate
(venv) % pip install numpy
Collecting numpy
  Downloading numpy-1.19.5-cp39-cp39-macosx_10_9_x86_64.whl (15.6 MB)
     |████████████████████████████████| 15.6 MB 411 kB/s 
Installing collected packages: numpy
Successfully installed numpy-1.19.5

So, if you use pip, you can solve it. ** But not recommended **. If you try to output requirements.txt with poetry, it's okay ...

% poetry config virtualenvs.create false
% python3.8 -m venv .venv && source .venv/bin/activate && pip install -U pip && (poetry export --without-hashes > requirements.txt) && pip install -r requirements.txt && deactivate

After that, if you do poetry install, it will pass, and poetry shell will also pass, but the feeling of korejanai is amazing. I want to solve it better.

Relation

Recommended Posts

I couldn't install numpy using poetry on macOS Big Sur, so I forcibly avoided it
Install Python 3.8.6 on macOS Big Sur using pyenv
I got an error when pip install tweepy on macOS Sierra, so I dealt with it
Get started with Python on macOS Big Sur
I got an error when pip install pandas on Mac, so I dealt with it