LoginSignup
117
65

More than 5 years have passed since last update.

pyenvでinstallできない

Last updated at Posted at 2018-01-09

pyenvでinstallができませんでした。前は何も問題なくできたのに。

$ pyenv install 3.5.3
Downloading Python-3.5.3.tar.xz...
-> https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz
Installing Python-3.5.3...
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (LinuxMint 18.3 using python-build 1.2.0-8-g785738d)

Inspect or clean up the working tree at /tmp/python-build.20180109204133.19143
Results logged to /tmp/python-build.20180109204133.19143.log

Last 10 log lines:
(cd /home/pokotsun/.pyenv/versions/3.5.3/share/man/man1; ln -s python3.4.1 python3.1)
if test "xupgrade" != "xno"  ; then \
    case upgrade in \
        upgrade) ensurepip="--upgrade" ;; \
        install|*) ensurepip="" ;; \
    esac; \
     ./python -E -m ensurepip \
        $ensurepip --root=/ ; \
fi
Ignoring ensurepip failure: pip 6.0.8 requires SSL/TLS

環境

linux mint 18.3

試した方法

1. エラーメッセージ内で

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems

と言ってくれているのでpyenvのwikiを見て試してみる。
とりあえず依存関係を入れなおして再度installをやってみる。

$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev

リトライ

$ pyenv install 3.5.3
Downloading Python-3.5.3.tar.xz...
-> https://www.python.org/ftp/python/3.5.3/Python-3.5.3.tar.xz
Installing Python-3.5.3...
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (LinuxMint 18.3 using python-build 1.2.0-8-g785738d)
(以下略)

うまくいかない

2. エラーメッセージと照らしあわせてwikiを見ていくとopensslがまずいっぽい。いままではうまくいってたので何か知らない間に壊してしまったのかもしれない。opensslを入れなおしてみた。

$ sudo apt-get remove libssl-dev
$ sudo apt-get install libssl-dev

リトライ

$ pyenv install 3.5.3

(以上略)

BUILD FAILED (LinuxMint 18.3 using python-build 1.2.0-8-g785738d)

(以下略)

うまくいかない...

その後また少し調べていくとgihubのissueで次の文を見つけた。

Hi, look at #945, it's because Debian 9 uses OpenSSL 1.1.0 which support in CPython was added in 3.5.3 (more details in the issue above). Cheers

試しに自分の環境でのopensslのバージョンを調べてみる。

$ openssl version
OpenSSL 1.1.0g  2 Nov 2017

ビンゴっぽい。

解決策

解決策まで提示してくれてた。ただし3.5.3以上じゃないとエラー出たりする。

$ CFLAGS=-I/usr/include/openssl LDFLAGS=-L/usr/lib pyenv install -v installしたいバージョン名,今回の場合は3.5.3

結構時間食ったので参考になれば嬉しいです。

参考

Common build problems · pyenv/pyenv Wiki
ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib? · Issue #950 · pyenv/pyenv

117
65
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
117
65