virtualenv: Can't install any package via `pip` on windows 10, ssl module in Python is not available

python version: 3.6 (Intel Distribution for Python for Windows 2018 update 1) virtualenv version: 15.1.0 windows version: windows 10 pro, build 17101.rs4_release.180211-1040

I executed only 2 commands, here is what Powershell output:

PS E:\Python\Virtualenv\Scripts> .\activate
(Virtualenv) PS E:\Python\Virtualenv\Scripts> pip install numpy
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting numpy
  Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: 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

This directory Python is not where the python installed, it is only a normal directory.

I have tried installing some standalone openssl, like the one from here, but neither of them worked.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 21
  • Comments: 54 (2 by maintainers)

Commits related to this issue

Most upvoted comments

I had the same issue. I was configuring a new computer with python and jupyter with anaconda, and the problem occured when I tried to install a package use pip.

Based on the discussions above, that this is an environment issue, I tried running “pip install” command in Anaconda Prompt instead of cmd. And the pip command was executed. 😁

If you prefer to use the Windows Command Prompt instead, you will need to add the following directories to your Windows Environment path: %Miniconda3_DIR%;%Miniconda3_DIR%\Library\mingw-w64\bin;%Miniconda3_DIR%\Library\usr\bin;%Miniconda3_DIR%\Library\bin;%Miniconda3_DIR%\Scripts;%Miniconda3_DIR%\bin; [where, %Miniconda3_DIR% should be substituted by your Miniconda (or Anaconda) install path]

For example, I have my Miniconda installed at E:\Portable\Miniconda3. So my Windows PATH had to include these folders: E:\Portable\Miniconda3;E:\Portable\Miniconda3\Library\mingw-w64\bin;E:\Portable\Miniconda3\Library\usr\bin;E:\Portable\Miniconda3\Library\bin;E:\Portable\Miniconda3\Scripts;E:\Portable\Miniconda3\bin;

For Windows 10 If pip install is not working on CMD prompt, run it using Anaconda prompt - it works.

If you want use pip in normal CMD, not only in Anaconda prompt. you need add 3 environment paths. like these: D:\Anaconda3; D:\Anaconda3\Scripts; D:\Anaconda3\Library\bin

most people only add D:\Anaconda3\Scripts;

@EthanBackToLife I checked the PATH environment variable in the Anaconda prompt, and found that Anaconda was prefixing all those directories to its prompt PATH variable. So I appended the delta part of that path to the Windows PATH variable to confirm that it worked for pip.

While trying to install Conda on a different PC, I am able to refine the path changes to a much shorter: %Miniconda3_DIR%;%Miniconda3_DIR%\Scripts;%Miniconda3_DIR%\Library\bin [On hindsight, we see that the other directories that were added to the path from my previous post are non-existent/empty on a fresh Conda install.]

With this narrowing down of the path, we can look at the %Miniconda3_DIR%\Library\bin folder. In here, we find files such as: libcrypto-1_1-x64.dll, libcrypto-1_1-x64.pdb, libssl-1_1-x64.dll, openssl.exe, libssl-1_1-x64.pdb, openssl.pdb which I think are critical in resolving the SSL/TLS issues with the pip (and conda) package installs.

Fixed for me, thanks for everyone’s comments. The issue wasn’t fixed by adding <path to Anaconda3>\Anaconda3\Library\bin to the path, or even the top of the path. The same is true for \Anaconda3\Scripts and \Anaconda3\Library\mingw-w64\bin.

Tried replacing env’s libssl-1_1-x64.dll with the base env’s libssl-1_1-x64.dll - but didnt help. Could there be any other file that’s causing this?

Removing both libssl-1_1-x64.dll and libcrypto-1_1-x64.dll in C:/Windows/System32/ fixed the problem for me.

SSL libraries are in your C:\anaconda\Library\bin folder. You have to have that path set at the moment of trying to install your libraries. This is because, when you activate a virtual environment, the PATH is changed.

Therefore,

  • If you do not use virtual environments, manually set the PATH to:
set PATH=C:\anaconda;C:\anaconda\Scripts;C:\anaconda\Library\bin
pip  install any_library
or
pip install -r requirements.txt

  • If you do use virtual environments, manually set the PATH to:
set PATH=C:\venvs\ve1\;C:\venvs\ve1\Scripts;C:\anaconda\Library\bin
pip  install any_library
or
pip install -r requirements.txt

Note that C:\anaconda\Library\bin is consistent in both cases, regardless if you are working in a vm or not.

Thanks for the helpful comments above! Adding the following to the path variable worked for me on Windows 10: C:\Users.…\Anaconda3 C:\Users.…\Anaconda3\Scripts C:\Users.…\Anaconda3\Library\bin

If pip install pandas is not working on CMD prompt, run this using Anaconda prompt - it works. You can find Anaconda prompt using this:

Go with the mouse to the Windows Icon (lower left) and start typing “Anaconda”. There should show up some matching entries. Select “Anaconda Prompt”. A new command window, named “Anaconda Prompt” will open. Source - https://stackoverflow.com/questions/47914980/how-to-access-anaconda-command-prompt-in-windows-10-64-bit

" I can solve this problem by adding dir path of intel-python which has libeay32.dll (in my case …\IntelPython3\pkgs\openssl-1.0.2l-vc14_intel_0\Library\bin) in system environment as top most position."

reference: https://software.intel.com/en-us/forums/intel-distribution-for-python/topic/737878

I had the same problem. Using willliu1995 suggestion solved the problem. Running pip from cmd prompt did nor work but launching jupyter notebook and running !pip install <package> worked.

Hi when in the anaconda prompt i am unable to use pip due to TSL/SSL issues:

(base) C:\Users\joshu>pip install pandahouse
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

But i am able to pip install anything I want when using python native:

C:\Users\joshu\AppData\Local\Programs\Python\Python37\Scripts>pip install scrapy
Collecting scrapy
  Downloading http....

What I’ve done so far:

  1. Installed Python first
  2. Installed anaconda
  3. Reinstalled anaconda
  4. Removed libcrypto-1_1-x64.dll and libssl-1_1-x64.dll from System32/
  5. Added my Anaconda libraries to the top system and user variables of PATH C:\Users\joshu\Anaconda3\Library\bin
  6. Still does not work

CMD Prompt Locations in native Python:

C:\Users\joshu\AppData\Local\Programs\Python\Python37\Scripts>where libssl-1_1-x64.dll
C:\Users\joshu\Anaconda3\Library\bin\libssl-1_1-x64.dll

C:\Users\joshu\AppData\Local\Programs\Python\Python37\Scripts>where libcrypto-1_1-x64.dll
C:\Users\joshu\Anaconda3\Library\bin\libcrypto-1_1-x64.dll

Anaconda Prompt locations:

(base) C:\Users\joshu>where libssl-1_1-x64.dll
C:\Users\joshu\Anaconda3\Library\bin\libssl-1_1-x64.dll

(base) C:\Users\joshu>where libcrypto-1_1-x64.dll
C:\Users\joshu\Anaconda3\Library\bin\libcrypto-1_1-x64.dll

Not sure if this matters but OPENSSL_CONF C:\OpenSSL-Win64\bin\openssl.cfg appears above PATH in my system variables.

Could someone please help I am not sure how to solve this and would really prefer using Anaconda/Spyder instead of native python

try using:

pip3 install <package>

install Win64OpenSSL_Light-1_1_1b.exe https://slproweb.com/download/Win64OpenSSL_Light-1_1_1b.exe ,then pip works well.

I love you buddy! Removing both libssl-1_1-x64.dll and libcrypto-1_1-x64.dll in C:/Windows/System32/ fixed the problem for me.

Alternative solution: I just managed to make it work by creating a pip.ini file under C:\Users\my_user_name\pip, writing:

[global]
index-url=http://pypi.douban.com/simple/ [install] trusted-host=pypi.douban.com

It solves the problem for the moment, however the download speed using this mirror is not really fast (around 800kb/s). Is there a way to make it work as usual?

@SnarkyPapi, you say “I believe the paths are added correctly.” To confirm this fact, run the 4 commands listed in bold below.

  1. Command: > where python Output should be something like: C:\Miniconda3-x64\python.exe

  2. Command: > where pip Output should be something like: C:\Miniconda3-x64\Scripts\pip.exe

  3. Command: > where openssl Output should be something like: [Note that it’s possible that openssl.exe is installed in multiple locations of the environment path. In my case, openssl has also been installed as part of the Perl installation] C:\Perl\c\bin\openssl.exe C:\Miniconda3-x64\Library\bin\openssl.exe

  4. Command: > where libssl-1_1-x64.dll Output should be something like: C:\Miniconda3-x64\Library\bin\libssl-1_1-x64.dll

For any of these, if you get an output that says “INFO: Could not find files for the given pattern(s).”, then one of the required path components needed for pip is missing for your environment.

Specify path C:\Anaconda3\Library\bin in environment user variables. Or Just check wheather you have openssl installed in base python If not just install using following command pip install pyopenssl

I still have this problem after doing what @shriprem commented. Python version 3.7.1 and pip version 18.1, if that helps.

It might not be a venv problem but it is still a problem. In my instance I cannot install in venv or system pip I have IntelPython3 installed on Win 10 64 bit and YES it has openssl installed and compiled but for some reason things does not work

I have seen this: [(https://software.intel.com/en-us/forums/intel-distribution-for-python/topic/737878#comment-1920719)]

But I could not fix my version of this problem.

Any advice on this issue would be very helpfull

Right, PyPI uses https now, so you need ssl support. If your system Python doesn’t have it, your virtualenv won’t have it either. With Python 3, you should be able to import an ssl module:

>>> import ssl

Your best bet might be to switch to an interpreter which has the ssl module. The 3.6.4 interpreter I just now downloaded from https://www.python.org/ seems to have ssl support.