6
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pip使おうとするとSSL module is not available.になる件

Last updated at Posted at 2020-04-03

##先に結論
#####1. pythonをinstallし直しましょう。

$pyenv install <使いたいpythonのversion>

#####2. pipをinstallし直しましょう。

$ curl -kL https://bootstrap.pypa.io/get-pip.py | python

##環境
macOS 10.14.6
pyenv
##経緯
久しぶりにmacでpython使う用事ができた。
どれ、必要なモジュールをpipで入れようかな?
##発生事態
一先ず、searchしたろかい、ポチッとな。

$ pip search blurblur
Exception:
Traceback (most recent call last):
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 583, in urlopen
    conn = self._get_conn(timeout=pool_timeout)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 257, in _get_conn
    return conn or self._new_conn()
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py", line 808, in _new_conn
    raise SSLError("Can't connect to HTTPS URL because the SSL "
pip._vendor.requests.packages.urllib3.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/commands/search.py", line 45, in run
    pypi_hits = self.search(query, options)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/commands/search.py", line 62, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/xmlrpc/client.py", line 1112, in __call__
    return self.__send(self.__name, args)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/xmlrpc/client.py", line 1452, in __request
    verbose=self.__verbose
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/download.py", line 775, in request
    headers=headers, stream=True)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 522, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/download.py", line 386, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/cachecontrol/adapter.py", line 47, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/Users/someone/.pyenv/versions/3.6.1/lib/python3.6/site-packages/pip/_vendor/requests/adapters.py", line 497, in send
    raise SSLError(e, request=request)
pip._vendor.requests.exceptions.SSLError: Can't connect to HTTPS URL because the SSL module is not available.

オウフ...
##試行錯誤
とりあえずは、先生に訊きます。常識です。
https://qiita.com/akashixi/items/14d05ddf0a3d1176956c
https://www.unknownengineer.net/entry/2018/06/20/191011
https://www.secat-blog.net/wordpress/python3-cannot-install-numpy-by-pip-fix/
みんな、python3.8.0を入れたり、openSSLを更新したりしてますね。

真似して、3.8.0を入れてpipしてみたらSSLErrorは吐かず。
でも、3.6.1にすると相変わらずのSSLError。
opensslを更新して、デフォから切り替えたりもしました。

$brew install openssl
$echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

それでもSSLErrorは治らず。

##解決
pythonをinstallし直します。

$ pyenv install 3.6.1

pipもインストールし直します。

$ curl -kL https://bootstrap.pypa.io/get-pip.py | python

で、pipを使ってみると...

$ pip search blur
blur (0.4)                         - A chance art toolkit.
blur-clip-board-image-cli (0.0.4)  - Blur clip board image command line tool for macOS
pyblur (0.2.3)                     - Image blurring routines
WallaBlur (1.0.1)                  - blur background on window opening
pillow-stackblur (0.0.2)           - The Pillow filter for Stack Blur.
blurit (0.0.12)                    - This package is aimed to build to blur different portions of a image. Currently it blurs eyes in human photograph.
BlurWal (1.1.1)                    - Smoothly blurs the wallpaper when windows are opened.
pysaber (0.1.5)                    - Python package that implements a systems approach to blur estimation and reduction (SABER)
azureblur (0.1)                    - The triple box blur implementation from Firefox&#8217;s moz2d/Azure, with Python bindings.
imgic (0.2.8)                      - A basic numpy-based image manipulation package. Contains tools for resizing, cropping, blurring, and others.
Products.ImageEditor (3.0.0)       - adds a "Image Editor" link near the image widget  allowing the user to rotate, flip, blur, compress, change contrast & brightness, sharpen, add drop shadows, crop, resize
                                     an image, save as, and apply sepia.

やったぜ。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?