1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pyenvでinstallのビルドが失敗した時の解消法

Last updated at Posted at 2023-12-20

背景

pyenvでPython3.6をインストールしようとしたらビルドが失敗してしまった。

BUILD FAILED (OS X 14.1.2 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/_q/p7r22lmn5dn_6zlcvbrmmgqc0000gn/T/python-build.20231220180512.39601
Results logged to /var/folders/_q/p7r22lmn5dn_6zlcvbrmmgqc0000gn/T/python-build.20231220180512.39601.log

Last 10 log lines:
                case upgrade in \
                        upgrade) ensurepip="--upgrade" ;; \
                        install|*) ensurepip="" ;; \
                esac; \
                DYLD_LIBRARY_PATH=/var/folders/_q/p7r22lmn5dn_6zlcvbrmmgqc0000gn/T/python-build.20231220180512.39601/Python-3.6.15 ./python.exe -E -m ensurepip \
                        $ensurepip --root=/ ; \
        fi
dyld[53570]: missing symbol called
/bin/sh: line 1: 53570 Abort trap: 6           DYLD_LIBRARY_PATH=/var/folders/_q/p7r22lmn5dn_6zlcvbrmmgqc0000gn/T/python-build.20231220180512.39601/Python-3.6.15 ./python.exe -E -m ensurepip $ensurepip --root=/
make: *** [install] Error 134

エラーを見てみても原因はわからなかった。

対処

とりあえずhomebrewを最新にアップデートしてみた。

brew update
brew upgrade

それでもエラーが出たので brew doctor で警告が出ていないか見てみた。
どうやらHomebrewが/opt/homebrew以外にインストールされているらしい...

Warning: Your Homebrew's prefix is not /opt/homebrew.

Many of Homebrew's bottles (binary packages) can only be used with the default prefix.
Consider uninstalling Homebrew and reinstalling into the default prefix.
It is expected behaviour that some formulae will fail to build in this unsupported configuration.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

公式を見ながらHomebrewを再インストール
https://github.com/Homebrew/install
そしてもう一度pyenvでpython3.6 をインストールしてみる

$ pyenv install 3.6
WARNING: The Python lzma extension was not compiled. Missing the lzma lib?
Installed Python-3.6.15 to /Users/<path>/.pyenv/versions/3.6.15

なんかエラーは出たけどインストールできたっぽい?
一応versionsで確認してみる

$ pyenv versions
  system
  2.7.18
  3.2.6
  3.6.15
  3.8.7
* 3.9.4 
  3.9.10
  3.10.9

インストールできていた。

まとめ

pyenvでインストールが失敗する場合は、"brew doctor" で警告が出ていないか見てみるとよいかも。
今回はHomebrewのインストール先が推奨されていない場所だったため失敗していた可能性が高い。(他のエラーも考えられるかもしれないから警告をチェックする)

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?