2
1

pipenvでsslエラー

Last updated at Posted at 2023-11-05

pipenv syncで ssl エラー

pipenv syncで環境構築を行おうとしたところ,ssl エラーが発生した.その解決策を未来の自分に向けて残しておく.

環境

  • MacBook Pro (M1, 2020)
  • macOS Sonoma 14.0
  • Python 3.10.11
  • pip 23.3.1
  • pipenv, version 2023.10.24

問題点

pipenv syncで環境を構築しようとしたところ,以下のエラーが発生した.

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

解決策

brewが使えるなら,以下のコマンドを実行する.

terminal
brew install openssl@1.1

今まではbrew install opensslでインストールしていたが,これで install されていたのはopenssl3だった.openssl@1.1が必要らしいので改めてインストールした.

これを行うとしっかりとpipenv syncが通るようになった.

参考

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