LoginSignup
5
3

More than 1 year has passed since last update.

CentOS7にpython3.10系を入れた場合のSSLエラー(pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.)

Posted at

前提

  • docker(CentOS7)を作成
  • 上記にPython3.10.5をインストール
  • pipで別途用意したrequirements.txtのライブラリをインストールしようとしていた

問題点

  • "pip install -r requirements.txt"を実行しようとしたら、SSLエラーが発生した

エラー内容

WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/asgiref/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/asgiref/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/asgiref/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/asgiref/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/asgiref/
Could not fetch URL https://pypi.org/simple/asgiref/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/asgiref/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement asgiref==3.5.2 (from versions: none)
ERROR: No matching distribution found for asgiref==3.5.2
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

やらないといけなかったこと

  • そもそもPython3.10系はopen-sslのv1.1.1以上が必須になっていた
  • CentOS7にはopen-sslの1.1.1が入っていないので、自分でインストールしてあげる必要がある
  • 以下のコマンドを実行すればOK
yum install epel-release
yum install openssl11 openssl11-devel

export CFLAGS=$(pkg-config --cflags openssl11)
export LDFLAGS=$(pkg-config --libs openssl11)

./configure
make
sudo make install

結論

公式ドキュメントをちゃんと読まないとだめですね。。。

5
3
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
5
3