It's a trouble around the environment that comes up regularly, but this time it was caused by upgrading the OS of Mac to Big Sur.
--When using python with pyenv on Big Sur, I got a mysterious error saying macOS 11 or later required!
And python crashed.
--The above can be solved by using python3.9.1, but then pyarrow
does not support it and cannot be installed.
--grpcio cannot be installed
--An error occurs around numpy!
Since that happened, I will write the workaround. I think it will be unnecessary someday, but it's quite annoying as of now.
macOS 11 or later required!
It's like this.
% python -c "import tkinter; r = tkinter.Tk()"
macOS 11 or later required !
zsh: abort python -c "import tkinter; r = tkinter.Tk()"
I don't use Tk! You might think, but matplotlib or something will try to use it.
It seems to have happened in Python like I installed it via pyenv (probably after making it Big Sur), but it was solved by changing python to 3.9.1. If you have pyenv in brew, it will look like this:
% brew install tcl-tk #It is unconfirmed whether this is necessary, but there was a place where it was written so
% brew upgrade pyenv
% pyenv install -l | grep 3.9 # 3.Find 9 series
3.9.0
3.9-dev
3.9.1
miniconda-3.9.1
miniconda3-3.9.1
% pyenv install 3.9.1 # 3.9.1 is the newest so do it
% pyenv local 3.8.7 #Version that gives an error
% python -c "import tkinter; r = tkinter.Tk()"
macOS 11 or later required !
zsh: abort python -c "import tkinter; r = tkinter.Tk()"
% pyenv local 3.9.1
% python -c "import tkinter; r = tkinter.Tk()"
###No error! ###
That said, not all projects can be easily updated to 3.9 series, and in that case, Python installed via a legitimate installer is okay (unconfirmed).
It seems that pyarrow is needed by libraries like the pandas
extension of pyathena
, and it's affected if you use them.
I couldn't install it with pip or poetry normally, so I will forcibly install the 3.8 series wheel (probably working properly). It seems that it is good to change the cp38
part to cp39
. It's a terrible method, but it can't be helped ...
% curl -LO https://files.pythonhosted.org/packages/14/75/9f116c8d0774ed170c59c87649d3e74dbdaf3318d72a09171c6f4634c7a7/pyarrow-2.0.0-cp38-cp38-macosx_10_13_x86_64.whl
% mv pyarrow-2.0.0-cp38-cp38-macosx_10_13_x86_64.whl pyarrow-2.0.0-cp39-cp39-macosx_10_13_x86_64.whl
% pip install pyarrow-2.0.0-cp39-cp39-macosx_10_13_x86_64.whl
Now, if you try to install with poetry or pipenv, nothing will happen and no error will occur because it is already installed.
Since I came across the trouble around Big Sur at the beginning, I forgot what kind of condition it occurred, but it was good to put this in advance as follows.
% pip install --upgrade pip setuptools wheel
% pip install --no-cache-dir --force-reinstall -Iv grpcio==1.34.0
Apparently Accelerator somehow got an error for that reason. It's a bit bad because it causes an error at runtime, not at install. I was able to avoid it by installing it like this.
% brew install openblas
% OPENBLAS="$(brew --prefix openblas)" pip install numpy
Recently, I manage it with poetry, but after all, I managed to install it with this procedure.
% pyenv local 3.9.1
% poetry run pip install --upgrade pip setuptools wheel
% poetry run pip install --no-cache-dir --force-reinstall -Iv grpcio==1.34.0
% curl -LO https://files.pythonhosted.org/packages/14/75/9f116c8d0774ed170c59c87649d3e74dbdaf3318d72a09171c6f4634c7a7/pyarrow-2.0.0-cp38-cp38-macosx_10_13_x86_64.whl
% mv pyarrow-2.0.0-cp38-cp38-macosx_10_13_x86_64.whl pyarrow-2.0.0-cp39-cp39-macosx_10_13_x86_64.whl
% poetry run pip install pyarrow-2.0.0-cp39-cp39-macosx_10_13_x86_64.whl
% OPENBLAS="$(brew --prefix openblas)" poetry install
I think it's a build error or an enemy that takes human time.
Recommended Posts