When I try to use pip, SSL module is not available.

Conclusion first

1. Reinstall python.
$pyenv install <The version of python you want to use>
2. Reinstall pip.
$ curl -kL https://bootstrap.pypa.io/get-pip.py | python

environment

macOS 10.14.6 pyenv

Background

After a long time, I was able to use python on mac. Which module should I use with pip?

Occurrence

First of all, I searched for it.

$ 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.

Ouch ...

trial and error

For the time being, I will ask the teacher. It's common sense. 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/ Everyone is installing python3.8.0 and updating openSSL.

I imitated it, put 3.8.0 and pip it, but it didn't throw SSLError. However, when I set it to 3.6.1, the SSL Error is still the same. I also updated openssl and switched from default.

$brew install openssl
$echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.bash_profile

Still, SSLError is not cured.

Solution

Reinstall python.

$ pyenv install 3.6.1

Reinstall pip as well.

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

So, when I try using 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.

I did it.

Recommended Posts

When I try to use pip, SSL module is not available.
It is convenient to use Icecream instead of print when debugging.
When I try to use pip, SSL module is not available.
The story of when I was addicted to Caused by SSLError ("Can't connect to HTTPS URL because the SSL module is not available.")
When I try to make Apache SSL, it doesn't start.
python note: when easy_install is not available
Is it deprecated to use pip directly?
When I tried to use pip with python, I was told that XML_SetHashSalt could not be found.
Could not update pip due to ssl
When I try to upgrade pip, I get an infinite loop after failing to upgrade
When I try to use Jupiter notebook on Mac, I can only select python2
I want to refute "Ruby is not cool here"
When I try to import pandas on macOS I get the error No module named'_bz2'
When I deployed the Django app to Heroku, I got Module Not Found: <project-name> .wsgi.
I realized that it is nonsense to use the module without thinking because it is convenient.
When I try to connect to MySQL with mysql-connector-python, I cannot connect with the error "SSL connection error: SSL_CTX_set_tmp_dh failed"
When Pydev is not displayed even after adding Pydev5.2 to Eclipse (2016/8/30)
What to do when Japanese is not displayed on matplotlib
When I try to push with heroku, it doesn't work
Change the installation destination when --user is added to pip
I want to improve efficiency with Python even in an experimental system (4) Use ser.close () when an error is thrown using try syntax
When I try to run the pip command after updating pip, I get "No such file or directory"
Can be used when aws-cli is available but jq is not available jp.py
I got a TypeError:'int' object is not iterable when using keras
Freetype2 support not available on PIL when trying to blockdiag on CentOS6.5
I get an error when trying to install maec 4.0.1.0 with pip
I installed Swift tools to use ObjectStorage @ Bluemix (Python / pip, etc.)
It is convenient to use Icecream instead of print when debugging.
Build Python environment on Ubuntu (when pip is not the default)
How to use the optparse module
How to use the ConfigParser module
I want to get angry with my mom when my memory is tight
I tried to implement deep learning that is not deep with only NumPy
When you want to use it as it is when using it with lambda memo
I made an AI to judge whether it is alcohol or not!
It is better to use Weight Initializer when initializing with HeNormal with Chainer
Gist repository to use when you want to try a little with ansible
I was addicted to not being able to use Markdown on pypi's long_description
[Python] What to do when an error related to SSL authentication is returned
If pip stops due to SSL, it is better to re-insert python itself
I think it's a loss not to use profiler for performance tuning
It is convenient to use Layers when putting a library on Lambda
When I try to go back using chainer, it fits a little
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do when a warning message is displayed in pip list