LoginSignup
2
0

More than 5 years have passed since last update.

pyenv installでエラーが出た話(叙事的な話で、結局クリティカルな原因は不明)

Last updated at Posted at 2017-01-15

O'Reillyの「ゼロから作るDeep Learning」を読み始めた。
同書ではpython3系で進めていくということなのでpyenvで設定を。

$ pyenv install 3.5.1
Downloading Python-3.5.1.tar.xz...
-> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
Installing Python-3.5.1...
^C
BUILD FAILED (OS X 10.11.6 using python-build 1.0.6-13-g4d96271)

Inspect or clean up the working tree at /var/folders/rm/czd685gs0zsdx1z1yb3p446m0000gn/T/python-build.20170109121924.16365
Results logged to /var/folders/rm/czd685gs0zsdx1z1yb3p446m0000gn/T/python-build.20170109121924.16365.log

Last 10 log lines:
checking for execv... yes
checking for faccessat... yes
checking for fchmod... yes
checking for fchmodat... yes
checking for fchown... yes
checking for fchownat... yes
checking for fexecve... no
checking for fdopendir... yes
checking for fork... yes
checking for fpathconf... make: *** No targets specified and no makefile found.  Stop.

pyenv公式issueに(別のversionで)同じ問題に当たった人が。
https://github.com/yyuu/pyenv/issues/423
開発者のYamashitaさんがちゃんとコメントしてました。

Xcodeがちゃんと動いてないよーって...
http://qiita.com/tanakahisateru/items/c0eaa25dbde669b282cb
を参考に、とりあえずbrew doctorをしてみることに。

$ brew doctor
.
.
.
Warning: Your Xcode (8.1) is outdated.
Please update to Xcode 8.2 (or delete it).
Xcode can be updated from the App Store.
.
.
.

Xcodeのバージョンが古いって怒られてました。
インストールめっちゃ時間かかったけどとりあえず更新。
https://itunes.apple.com/jp/app/xcode/id497799835?mt=12

で、再度pyenv install 3.5.1をしたものの同じエラーに。

http://www.python-izm.com/contents/basis/pyenv.shtml
を見ていると
$ brew install readline xz
って叩いた記憶ないな、と思ってやってみたらエラーが変わった。

/private/var/folders/rm/czd685gs0zsdx1z1yb3p446m0000gn/T/python-build.20170111003433.38822/Python-3.5.1/python.exe: No module named ensurepip.__main__; 'ensurepip' is a package and cannot be directly executed

いやそれはなんかそろそろ僕が悪くない気がしてきた...
そういえば初回install時にやたら時間かかるなあと思って^Cってやっちゃった気が。
そのせいで悪さしてるとしたら、、、? 一旦リセットだ!ええい!

$ rm -rf /var/folders/rm/czd685gs0zsdx1z1yb3p446m0000gn/T/python-build.*

そしてpyenv install 3.5.1を再度叩いて、ちゃんとtailで生成されるlogを追う。
...無事成功!!!

$ pyenv install 3.5.1
Downloading Python-3.5.1.tar.xz...
-> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tar.xz
Installing Python-3.5.1...
Installed Python-3.5.1 to /Users/username/.pyenv/versions/3.5.1
$ tail -f -n 100 /var/folders/rm/czd685gs0zsdx1z1yb3p446m0000gn/T/python-build.20170115134121.24695.log

結局根本的な原因はわからなかったけど、Xcodeとか関係なく、最初から
$ rm -rf /var/folders/rm/czd685gs0zsdx1z1yb3p446m0000gn/T/python-build.*
一発で解決していたのではないかという話でした。

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