3

I got the error:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

while trying to install numpy inside a virtual environment in visual studio code. I have noticed the following:

  1. If I do "pip install numpy" outside the virtual environment in VS code, everything is fine.
  2. While I use "py -3 -m venv NameOfVirtualEnvironment" to create the virtual environment in VS code, no .vscode file is created.
  3. I couldn't do "pip install SSL" or any other rememdies to fix the problem as recommended in the previous similar posts.
  4. I can "pip install numpy" in a command window smoothly.

Here is the detailed error message I got:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting numpy
  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/numpy/
  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/numpy/
  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/numpy/
  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/numpy/
  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/numpy/
  Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
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

1 Answers1

0

I got the same error trying to use Python 3.9.7 from Miniconda together with Microsoft's Python extension for Visual Studio Code. The error was resolved by the following steps:

  • Install a version of Python (I installed Python 3.10.0) from https://www.python.org/downloads/, as supported by the extension according to its installation instructions.
  • Choose that Python installation using CTRL-SHIFT-P → Python:Select Interpreter.