Issues with installing python libraries on Windows : CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/anaconda/win-64

I'd like to install the pymongo library but I'm getting the following error:

    (C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
    conda install -c anaconda pymongo

    Fetching package metadata ...
    CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/a
    naconda/win-64/repodata.json>
    Elapsed: -
    
    An HTTP error occurred when trying to retrieve this URL.
    HTTP errors are often intermittent, and a simple retry will get you on your way.
    
    ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='conda.anaconda.org', por
    t=443): Max retries exceeded with url: /anaconda/win-64/repodata.json (Caused by
     ConnectTimeoutError(<urllib3.connection.VerifiedHTTPSConnection object at 0x000
    00000054D6128>, 'Connection to conda.anaconda.org timed out. (connect timeout=9.
    15)'))",),)

Steps taken to resolve:

1. Update C:\Users\\xxxxxxx\.condarc file with the following:

channels:
  - defaults
ssl_verify: false
proxy_servers:
http: http://sproxy.fg.xxx.com:1000
https: https://sproxy.fg.xxx.com:1000

2. (C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
    conda config --set ssl_verify False

Additional Info:

(C:\Users\xxxxxxx\AppData\Local\Continuum\anaconda3) C:\Users\xxxxxxx>
conda info

Current conda install:

               platform : win-64
          conda version : 4.3.27
       conda is private : False
      conda-env version : 4.3.27
    conda-build version : 3.0.22
         python version : 3.6.2.final.0
       requests version : 2.18.4
            config file : C:\Users\xxxxxxx\.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.27 requests/2.18.4 CPython/3.6.2 Windows/7 W
indows/6.1.7601
          administrator : False

A number of posts online simply reinstalled Anaconda, any other options apart from a fresh install?


Solution 1:

This works a charm:-

Just copy these:-

  1. libcrypto-1_1-x64.dll

  2. libssl-1_1-x64.dll

from D:\Anaconda3\Library\bin to D:\Anaconda3\DLLs.

Solution 2:

Execute the following command in the cmd prompt/terminal:

conda config --set ssl_verify no

Solution 3:

I try to create a virtual env with python 2.7 with anaconda, the base env is python 3.7. I encounter the exactly same problem. It turns out that there isn't such problem with other virtual envs with python 3.7 or 3.6.

This post works perfectly to solve my problem on win7 with anaconda prompt. It basically says you need to add the following directories into your user environment path in windows (go to Start and type in: View Advanced System Settings, then select Environmental Variables: then select Path and click Edit: finally you can click New and add a path):

C:\your_directory_to_anaconda3\Anaconda3\Scripts

C:\your_directory_to_anaconda3\Anaconda3\

C:\your_directory_to_anaconda3\Anaconda3\Library\bin -- This is the directory for openssl

Solution 4:

If you added conda to your PATH variables, remove it and use the "Anaconda Prompt". This solved the problem for me.

See: https://github.com/conda/conda/issues/8046#issuecomment-450582208