Ubuntu 16.04 での pip インストール

いくつかエラーが発生したため、記録を残しておく。

# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"
# curl -O https://bootstrap.pypa.io/get-pip.py
# python get-pip.py
# pip --version
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
  warnings.warn(warning, RequestsDependencyWarning)
pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
# pip install --upgrade cryptography
...
# pip --version
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 40, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/autocompletion.py", line 8, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/main_parser.py", line 12, in <module>
    from pip._internal.commands import (
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/__init__.py", line 6, in <module>
    from pip._internal.commands.completion import CompletionCommand
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/commands/completion.py", line 6, in <module>
    from pip._internal.cli.base_command import Command
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cli/base_command.py", line 18, in <module>
    from pip._internal.download import PipSession
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/download.py", line 15, in <module>
    from pip._vendor import requests, six, urllib3
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
    from pip._vendor.urllib3.contrib import pyopenssl
  File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
    import OpenSSL.SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/__init__.py", line 8, in <module>
    from OpenSSL import rand, crypto, SSL
  File "/usr/lib/python2.7/dist-packages/OpenSSL/SSL.py", line 118, in <module>
    SSL_ST_INIT = _lib.SSL_ST_INIT
AttributeError: 'module' object has no attribute 'SSL_ST_INIT'

# python -m easy_install --upgrade pyOpenSSL
Searching for pyOpenSSL
Reading https://pypi.org/simple/pyOpenSSL/
Downloading https://files.pythonhosted.org/packages/96/af/9d29e6bd40823061aea2e0574ccb2fcf72bfd6130ce53d32773ec375458c/pyOpenSSL-18.0.0-py2.py3-none-any.whl#sha256=26ff56a6b5ecaf3a2a59f132681e2a80afcc76b4f902f612f518f92c2a1bf854
Best match: pyOpenSSL 18.0.0
Processing pyOpenSSL-18.0.0-py2.py3-none-any.whl
Installing pyOpenSSL-18.0.0-py2.py3-none-any.whl to /usr/local/lib/python2.7/dist-packages
writing requirements to /usr/local/lib/python2.7/dist-packages/pyOpenSSL-18.0.0-py2.7.egg/EGG-INFO/requires.txt
Adding pyOpenSSL 18.0.0 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/pyOpenSSL-18.0.0-py2.7.egg
Processing dependencies for pyOpenSSL
Finished processing dependencies for pyOpenSSL
root@VirtualMachine01:/usr/local/sbin# pip --version
pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

# pip --version
pip 18.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)

参考URL

https://stackoverflow.com/questions/51283708/python-pip-package-requestsdependencywarning-when-installing-elastic-search-cura

メニューを閉じる