LoginSignup
5
0

More than 1 year has passed since last update.

Mac(M1)にpip3 install pyqt5でpyqt5をインストールしようしようとするとエラーになる(Preparing metadata (pyproject.toml) ... error)

Last updated at Posted at 2023-01-22

Mac(M1)にpip3 install pyqt5でpyqt5をインストールしようしようとするとエラーになる(Preparing metadata (pyproject.toml) ... error)

以下のようなエラーがネット上でも報告されている

https://github.com/Homebrew/discussions/discussions/1690

% pip3 install PyQt5
Collecting PyQt5
  Using cached PyQt5-5.15.7.tar.gz (3.2 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      Querying qmake about your Qt installation...

homebrew(Macでよく使うパッケージマネージャ)からインストールすると成功する
それだけだと使えないと思うので環境変数を設定してパスを通す。

MacBook Pro (Apple Silicon, M1 PRO, 2021) でPython開発環境を整える

brew install pyqt5

シンボリックリンクを貼ることでも解決できそう(以下は例、実際のパスに合わせて適宜要修正)
具体的にはhomebrewでインストールした先のディレクトリ(/opt/homebrew/Cellar/pyqt@5/${pyqt_version}/lib/python${python_version}/site-packages/*..)
から、現在使用しているpythonのディレクトリのsite-packages($(dirname $(which python))/../lib/python${python_version}/site-packages/)にリンクを貼るとよさそう。

python_version=3.10    ## 適宜要修正
pyqt_version=5.15.7_2  ## 適宜要修正 
ln -s /opt/homebrew/Cellar/pyqt@5/${pyqt_version}/lib/python${python_version}/site-packages/*  $(dirname $(which python))/../lib/python${python_version}/site-packages/

これで成功したと思うので一旦ここに記事を残して解決とする。
(本当はpip3 install時のエラーが解決されたら楽なのにな、など思いつつ)

参考

5
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
5
0