[PYTHON] Notes on what to do if "macOS 11 or later required!" Appears in Big Sur or pyarrow2.0.0 cannot be installed

Introduction

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.

Summary of troubles

--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.

Individual remedy

Dealing with macOS 11 or later required!

Reproduction method

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.

approach

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

Check if it can be cured

% 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! ###

When you can't do python3.9 series ...?

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).

pyarrow2.0.0 doesn't support python3.9!

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.

grpcio cannot be 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

I get an error around numpy!

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

Summary

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

at the end

I think it's a build error or an enemy that takes human time.

Recommended Posts

Notes on what to do if "macOS 11 or later required!" Appears in Big Sur or pyarrow2.0.0 cannot be installed
What to do if PyAudio cannot be installed on Python 3.7, 3.8, 3.9 on Windows
What to do if pip cannot be installed
What to do if the package dependency cannot be repaired
What to do if pip install mysqlclient fails on MacOS
What to do if ʻObject arrays cannot be loaded when allow_pickle = False` occurs in numpy.load ()
What to do if grep: empty (sub) expression appears on Mac grep
What to do if you can't find PDO in Laravel or CakePHP
What to do if No Python documentation found for ... appears in pydoc
What to do in my case when pyenv install is not possible after upgrading to macOS Big Sur
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
What to do if NotADirectoryError: [Errno 20] Not a directory:'xdg-settings' appears in jupyter notebook
What to do if Japanese language support is not completely installed on Ubuntu 16.04
What to do if mod_fcgid cannot resolve UnicodeEncodeError
What to do if pvcreate produces a lot of WARNING and cannot be created
What to do if Python IntelliSense is not displayed in VS Code on Windows
What to do when "Type Error: must be _socket.socket, not socket" appears on GAE
What to do if pip install fails in Xcode 5.1
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
What to do if SciPy installation fails on CentOS
What to do if a UnicodeDecodeError occurs in pip
What to do if Jupyter Notebook on WSL does not start automatically in your browser
[* CentOS 6.10] What to do if you cannot add the IUS Community Project repository on CentOS 6.5 (VirtualBox)
What to do if you get a Cannot retrieve metalink for repository error in yum
What to do if you get an Undefined error:'Module_six_moves_urllib_parse' object has no attribute'urlencode' on MacOS
What to do if you get angry with "Gtk * backend requires pygtke to be installed" even though pygtk is included in matplotlib
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do if pip gives a DistributionError in Homebrew
What to do if you get "coverage unknown" in Coveralls
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if `pip install matplotlib` fails on Mac
What to do when "Invalid HTTP_HOST header" appears in Django
What to do if you can't log in as root
What to do if you can't use WiFi on Linux
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you get the message "" ~ .pkg "is corrupted and cannot be opened" when installing wxPython on Mac OS X
What to do if Python doesn't work on Git for Windows
Tensorflow-GPU seems to be together if it is TF2.0 or later?
What to do when a video cannot be read by cv2.VideoCapture
What to do if Insecure Platform Warning appears when running Python
What to do if "Unnamed: 0" is added in to_csv-> read_csv in pandas
What to do if you can't use the trash in Lubuntu 18.04.
What to do if you get "The session could not be opened" when installing CentOS on VirtualBox
What to do if PyInstaller3.5 gives an error in Python3.8 (TypeError: an integer is required (got type bytes))
What to do if you get the error Target WSGI script'/var/www/xxx/xxx.wsgi' cannot be loaded as python module
What to do if an error occurs in TensorFlow RNN related import or RNN (LSTM) Cell (v 0.11r ~)