1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Airflowをインストールする時に発生したエラー [Could not build wheels for google-re2, which is required to install pyproject.toml-based projects] の解決方法

Posted at

エラー概要

MacでApache Airflowをインストールしようとした時にエラー

$ pip install 'apache-airflow==2.7.1' \
 --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.7.1/constraints-3.8.txt"

エラー文は下記

Building wheels for collected packages: google-re2
  Building wheel for google-re2 (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for google-re2 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.15-x86_64-cpython-39
      copying re2.py -> build/lib.macosx-10.15-x86_64-cpython-39
      running build_ext
      building '_re2' extension
      creating build/temp.macosx-10.15-x86_64-cpython-39
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/hiro/.pyenv/versions/3.9.6/include/python3.9 -c _re2.cc -o build/temp.macosx-10.15-x86_64-cpython-39/_re2.o -fvisibility=hidden
      _re2.cc:11:10: fatal error: 'pybind11/pybind11.h' file not found
      #include <pybind11/pybind11.h>
               ^~~~~~~~~~~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for google-re2
Failed to build google-re2
ERROR: Could not build wheels for google-re2, which is required to install pyproject.toml-based projects

google-re2というパッケージ周りでエラー
下記を実行しても同様のエラーが出る

$ pip install google-re2

解決方法

原因はPythonのバージョン

自分はバージョン3.9.6を使っていたが、google-re2のPython 3.9用のバイナリバージョンはないらしい

So the problem is your Python thinks that it is on 10.9 and indeed there is no binary version for Python 3.9 of google-re2

Apache Airflow Community より引用

現時点で最新のバージョン3.11.5をインストール

$ pyenv install 3.11.5
$ pyenv global 3.11.5

その後Airflowをインストールすると成功した

$ pip install 'apache-airflow==2.7.1' \                                                 
 --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.7.1/constraints-3.8.txt"

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?