opensslが古いとpythonのいろんなところに問題が出る

More than 3 years have passed since last update.

この問題で3時間が消失しました.


一番の問題

easy_installが必要なパッケージを見つけてくれません.pipも同様です.

# easy_install pip

Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed -- Some packages may not be found!
Couldn't retrieve index page for 'pip'
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [Errno 1] _ssl.c:510: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed -- Some packages may not be found!
Best match: pip 6.0.6
Processing pip-6.0.6-py2.7.egg
pip 6.0.6 is already the active version in easy-install.pth
Installing pip script to /home/akisato/src/downloads/python-2.7.8/bin
Installing pip2.7 script to /home/akisato/src/downloads/python-2.7.8/bin
Installing pip2 script to /home/akisato/src/downloads/python-2.7.8/bin

Using /home/akisato/src/downloads/python-2.7.8/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg

# pip install setuptools --upgrade
Could not find any downloads that satisfy the requirement setuptools in ./lib/python2.7/site-packages/setuptools-12.0.1-py2.7.egg
Collecting setuptools
No distributions at all found for setuptools in ./lib/python2.7/site-packages/setuptools-12.0.1-py2.7.egg


yumすれば良いのに

yum install openssl-devel をすれば良いのでは,と思うかもしれませんが,root権限がない一般人にはできません.:p


差し当たりどうするか

まずはpipのtar.gzを入手して,インストールします.

# wget https://pypi.python.org/packages/source/p/pip/pip-6.0.6.tar.gz --check-no-certificate

# tar xzvf pip-6.0.6.tar.gz
# cd pip-6.0.6.tar.gz
# python setup.py build
# python setup.py install

このままだと,古いOpenSSLのせいで,pipがSSLの検証に失敗するので,pipを改造します.

(参考: docs/TSUBAME http://www.kyogoku.biz/docs/TSUBAME)

# vim ~/src/downloads/python-2.7.6rc1/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg/pip/downloads.py

Dispatch the actual request と書いてある行の次を,
return super(PipSession, self).request(method, url, verify=False, *args, **kwargs)
と書き換える。(verify=False を書き足す.)

これでさしあたりの問題は解決したはず.

# pip install python

Collecting ipython
Downloading ipython-2.3.1-py27-none-any.whl (2.8MB)
100% |################################| 2.8MB 274kB/s
Installing collected packages: ipython

Successfully installed ipython-2.3.1