LoginSignup
1
0

More than 3 years have passed since last update.

macOS Big Sur で poetry を使って numpy をインストールできなかったので無理やり回避した

Last updated at Posted at 2021-01-06

環境

  • OS: macOS Big Sur
  • Python : 3.8.7 (from Homebrew)
  • pip : 20.2.3
  • shell : zsh

発生した事象

pyproject.toml に次のような記述が含まれている状態で、 poetry install を行ったところ

[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

回避策

poetry を使わずに pip 20.3.3 を使うとインストールできる (python 3.9 を用いているものの、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

ので、pip を使えば解決は一応できます。が、おすすめしません。poetry で requirements.txtを出力するようにすればまあなんとか…。

% 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

このあと poetry install すると通りますし、poetry shell も通りますが、なんかコレジャナイ感がすごいです。よりよく解決したいですね。

関連

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0