New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CondaHTTPError: Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available) #6064

Closed
ehatton opened this Issue Oct 3, 2017 · 33 comments

Comments

Projects
None yet
@ehatton
Copy link

ehatton commented Oct 3, 2017

After a recent upgrade, I'm unable to search or update conda e.g.

conda search sh
Fetching package metadata ...
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://conda.anaconda.org/bioconda/linux-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.
SSLError(MaxRetryError('HTTPSConnectionPool(host=\'conda.anaconda.org\', port=443): Max retries exceeded with url: /
bioconda/linux-64/repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not avail
able.",))',),)'

A clean install of an older version, Anaconda3-4.4.0-Linux-x86_64, works fine.

The anaconda curl installation is also causing problems:

which curl
/home/ehatton/anaconda3/bin/curl
curl https://www.google.com
curl: error while loading shared libraries: libcrypto.so.1.0.0: cannot enable executable stack as shared object requ
ires: Invalid argument

Here is the info about my conda installation:

conda info
Current conda install:

               platform : linux-64
          conda version : 4.3.27
       conda is private : False
      conda-env version : 4.3.27
    conda-build version : not installed
         python version : 3.6.2.final.0
       requests version : 2.18.4
       root environment : /home/ehatton/anaconda3  (writable)
    default environment : /home/ehatton/anaconda3
       envs directories : /home/ehatton/anaconda3/envs
                          /home/ehatton/.conda/envs
          package cache : /home/ehatton/anaconda3/pkgs
                          /home/ehatton/.conda/pkgs
           channel URLs : https://conda.anaconda.org/bioconda/linux-64
                          https://conda.anaconda.org/bioconda/noarch
                          https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://repo.continuum.io/pkgs/main/linux-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /home/ehatton/.condarc
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.27 requests/2.18.4 CPython/3.6.2 Linux/4.4.0-43-Microsoft debian/stretch/sid gli
bc/2.23
                UID:GID : 1000:1000

I'm running Windows Subsystem for Linux with Ubuntu 16.04.3 LTS.

uname -a
Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux
@lauhayden

This comment has been minimized.

Copy link

lauhayden commented Oct 3, 2017

Similar issue on a fresh install of miniconda. I think the issue is less with conda but more with the distro - miniconda and anaconda.

conda info
Current conda install:

               platform : linux-64
          conda version : 4.3.27
       conda is private : False
      conda-env version : 4.3.27
    conda-build version : not installed
         python version : 3.6.2.final.0
       requests version : 2.18.4
       root environment : /home/hayden/miniconda3  (writable)
    default environment : /home/hayden/miniconda3
       envs directories : /home/hayden/miniconda3/envs
                          /home/hayden/.conda/envs
          package cache : /home/hayden/miniconda3/pkgs
                          /home/hayden/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/main/linux-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.27 requests/2.18.4 CPython/3.6.2 Linux/4.4.0-43-Microsoft debian/stretch/sid glibc/2.23
                UID:GID : 1000:1000
@choldgraf

This comment has been minimized.

Copy link

choldgraf commented Oct 4, 2017

I have the same problem as well

@tuannguyenthe

This comment has been minimized.

Copy link

tuannguyenthe commented Oct 4, 2017

I have the same problem, but only recently.

Exact Same build as @lauhayden - is it a problem on Windows Subsystem for Linux. I think it is the problem is from OpenSSL of Miniconda 3. Running OpenSSL of Miniconda3 results in error.

$ which openssl
/home/tuannt/miniconda3/bin/openssl
tuannt@PNCPT-TUANNT:~$ openssl
openssl: error while loading shared libraries: libcrypto.so.1.0.0: cannot enable executable stack as shared object requires: Invalid argument
$ /usr/bin/openssl
OpenSSL>

@mingwandroid

This comment has been minimized.

Copy link
Contributor

mingwandroid commented Oct 4, 2017

Seems you are running into this:

Microsoft/WSL#286

Can you try running execstack -c libcrypto.so.1.0.0 first and then try again?

I probably need to look into how openssl is being built here as I doubt it needs an executable stack.

@ehatton

This comment has been minimized.

Copy link
Author

ehatton commented Oct 4, 2017

Thanks @mingwandroid, that's fixed it for me.

n.b. for anyone else with this problem the exact command to run is:
execstack -c anaconda3/lib/libcrypto.so.1.0.0

@mingwandroid mingwandroid self-assigned this Oct 4, 2017

@lauhayden

This comment has been minimized.

Copy link

lauhayden commented Oct 4, 2017

Can confirm that executable stack flag is the issue. As OpenSSL seems to run fine without the flag, perhaps build should be tweaked to have the flag.

~$ which openssl
/home/hayden/miniconda3/bin/openssl
~$ openssl
openssl: error while loading shared libraries: libcrypto.so.1.0.0: cannot enable executable stack as shared object requires: Invalid argument
~$ execstack -c miniconda3/lib/libcrypto.so.1.0.0
~$ openssl
OpenSSL>

Note that I have previously installed and used conda just fine on WSL, something changed in the past ~week or so.

@lauhayden

This comment has been minimized.

Copy link

lauhayden commented Oct 4, 2017

For me, this is a fresh install of miniconda, nothing else installed. conda info output already posted above.

~$ conda list
# packages in environment at /home/hayden/miniconda3:
#
asn1crypto                0.22.0           py36h265ca7c_1
ca-certificates           2017.08.26           h1d4fec5_0
certifi                   2017.7.27.1      py36h8b7b77e_0
cffi                      1.10.0           py36had8d393_1
chardet                   3.0.4            py36h0f667ec_1
conda                     4.3.27           py36h2866c0b_0
conda-env                 2.6.0                h36134e3_1
cryptography              2.0.3            py36ha225213_1
idna                      2.6              py36h82fb2a8_1
libedit                   3.1                  heed3624_0
libffi                    3.2.1                h4deb6c0_3
libgcc-ng                 7.2.0                hcbc56d2_1
libstdcxx-ng              7.2.0                h24385c6_1
ncurses                   6.0                  h06874d7_1
openssl                   1.0.2l               h9d1a558_3
pip                       9.0.1            py36h30f8307_2
pycosat                   0.6.2            py36h1a0ea17_1
pycparser                 2.18             py36hf9f622e_1
pyopenssl                 17.2.0           py36h5cc804b_0
pysocks                   1.6.7            py36hd97a5b1_1
python                    3.6.2               hdfe5801_15
readline                  7.0                  hac23ff0_3
requests                  2.18.4           py36he2e5f8d_1
ruamel_yaml               0.11.14          py36ha2fb22d_2
setuptools                36.5.0           py36he42e2e1_0
six                       1.10.0           py36hcac75e4_1
sqlite                    3.20.1               h6d8b0f3_1
tk                        8.6.7                h5979e9b_1
urllib3                   1.22             py36hbe7ace6_0
wheel                     0.29.0           py36he7f4e38_1
xz                        5.2.3                h2bcbf08_1
yaml                      0.1.7                h96e3832_1
zlib                      1.2.11               hfbfcf68_1
@choldgraf

This comment has been minimized.

Copy link

choldgraf commented Oct 4, 2017

Note that I had to run execstack -c /path/to/anaconda/lib/libcrypto.so.1.0.0 for each environment I had created (if I wanted to use pip in that environment.

E.g. execstack -c /path/to/anaconda/envs/myenv/lib/libcrypto.so.1.0.0.**

@choldgraf

This comment has been minimized.

Copy link

choldgraf commented Oct 4, 2017

note that when I created another python environment w/ python 2, I'm getting weird errors with ipython and pip, e.g.:

ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "/home/choldgraf/anaconda/envs/python2/bin/pip", line 7, in <module>
    from pip import main
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/pip/__init__.py", line 21, in <module>
    from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/pip/_vendor/requests/__init__.py", line 62, in <module>
    from .packages.urllib3.exceptions import DependencyWarning
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/pip/_vendor/requests/packages/__init__.py", line 29, in <module>
    import urllib3
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/urllib3/connectionpool.py", line 29, in <module>
    from .connection import (
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/urllib3/connection.py", line 39, in <module>
    from .util.ssl_ import (
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/urllib3/util/__init__.py", line 6, in <module>
    from .ssl_ import (
  File "/home/choldgraf/anaconda/envs/python2/lib/python2.7/site-packages/urllib3/util/ssl_.py", line 7, in <module>
    from hashlib import md5, sha1, sha256
ImportError: cannot import name md5

It seems this is related to the same SSL problems described above

@kalefranz

This comment has been minimized.

Copy link
Member

kalefranz commented Oct 5, 2017

Seems to be related to new packaging. Going to bump over to the packaging issue tracker.

@kalefranz

This comment has been minimized.

Copy link
Member

kalefranz commented Oct 5, 2017

This issue was moved to ContinuumIO/anaconda-issues#6424

@MaximoTrinidad

This comment has been minimized.

Copy link

MaximoTrinidad commented Oct 9, 2017

I got the same error too on latest version of Windows 10 Insider 16299 Ubuntu. "Can't connect to HTTPS URL because the SSL module is not available".

@albertotb

This comment has been minimized.

Copy link

albertotb commented Oct 11, 2017

I can confirm that the execstack trick solves the issue for Python 3. However, for an environment with Python 2 I'm getting the same errors as @choldgraf. Anyone hows how to solve this issue in Python 2?

@briancrane

This comment has been minimized.

Copy link

briancrane commented Dec 23, 2018

Apparently latest version of Anaconda don't work with latest version of Win10. Using Win10 Pro Fall Update Insider's Edition. Got all of the above errors: 'Can't connect to HTTPS' same happened when I used -k to download unsecure. Had to go back to Anaconda4.4.x to get it working.

@chxiaowu

This comment has been minimized.

Copy link

chxiaowu commented Dec 26, 2018

Got the same error on win10, version Anaconda3-2018.12-Windows-x86_64.exe.

@MaximoTrinidad

This comment has been minimized.

Copy link

MaximoTrinidad commented Dec 26, 2018

Hi guys!

Keep in mind that this issue was closed. I think it's better to reopen a new one so it can be tracked properly.
:)

@valdrinium

This comment has been minimized.

Copy link

valdrinium commented Dec 30, 2018

I have managed to solve the problem by installing OpenSSL from here https://slproweb.com/products/Win32OpenSSL.html and adding the bin folder to the PATH

@msarahan

This comment has been minimized.

Copy link
Contributor

msarahan commented Dec 30, 2018

Please see #8046 for more discussion. It seems likely that there are DLL hell issues afoot.

@allanj

This comment has been minimized.

Copy link

allanj commented Jan 2, 2019

I solve the problem through the solution provided by @valdrinium

@donkelley

This comment has been minimized.

Copy link

donkelley commented Jan 7, 2019

valdrinium solved it for me, also! Under windows server 2016 I had this issue, and his install/path suggestion worked perfectly. This answer should become it's own post since the solution is unique under windows.

@skerrj

This comment has been minimized.

Copy link

skerrj commented Jan 10, 2019

for me it was just a simple path issue... running a win7

just needed to add ..\anaconda3\Library\bin to path...
...in addition to ..\anaconda3 and ..\anaconda3\Scripts

conda info
....
conda version : 4.5.12
conda-build version : 3.17.6
python version : 3.7.1.final.0
...
platform : win-64
user-agent : conda/4.5.12 requests/2.21.0 CPython/3.7.1 Windows/7 Windows/6.1.7601
...

@mhdr

This comment has been minimized.

Copy link

mhdr commented Jan 22, 2019

I resolved my problem by installing openssl
you can go here and download the Light version :
https://slproweb.com/products/Win32OpenSSL.html

@jankap

This comment has been minimized.

Copy link

jankap commented Jan 22, 2019

Did you install OpenSSL to the system directory or to somewhere else?

@prasad-mk

This comment has been minimized.

Copy link

prasad-mk commented Jan 23, 2019

@jankap, I installed it to C:\Program Files\OpenSSL-Win64, and restarted the Anaconda Prompt. pip didnt throw errors anymore. #

@Bacchusm

This comment has been minimized.

Copy link

Bacchusm commented Jan 26, 2019

on Windows I added the path to the environment then reboot my computer and it worked. Thanks

@dragonbook

This comment has been minimized.

Copy link

dragonbook commented Jan 29, 2019

On Windows, it still works fine under default 'base' environment, but suddenly cannot work in my new created environment. I add the path .\anaconda3\Library\bin which already contains OpenSSL to system, and restart Anaconda Prompt, then it works.
Thanks!

@kne42 kne42 referenced this issue Feb 5, 2019

Merged

Fix CI errors #104

@ronaldgreeff

This comment has been minimized.

Copy link

ronaldgreeff commented Feb 6, 2019

On Windows, it still works fine under default 'base' environment, but suddenly cannot work in my new created environment. I add the path .\anaconda3\Library\bin which already contains OpenSSL to system, and restart Anaconda Prompt, then it works.
Thanks!

I had this exact same issue (using Windows 10/Anaconda3.6 64-bit).

In (base), I could use "conda search"; within an environment, this resulted in the SSLError. All I did to resolve this was to run 'conda upgrade --all' whilst in (base).

Now it runs like a scouser.

@Nutingnon

This comment has been minimized.

Copy link

Nutingnon commented Feb 8, 2019

I met this problem and solved it by:

  1. open the anaconda navigator and change to the env you use
  2. search packages that have 'ssl' in its name
  3. update those packages (no more than 5 pkgs)

and I tired conda udpate --all again, it will work

@jankap

This comment has been minimized.

Copy link

jankap commented Feb 8, 2019

Does not work. Library/bin is on path can openssl.exe can be found by conda, but still error to load the module.
conda 4.6.2
anaconda 1.7.2

@mlewis22

This comment has been minimized.

Copy link

mlewis22 commented Feb 11, 2019

I've had the same issue - new laptop, clean install of miniconda 3.7 on windows 10. Updates to the path haven't fixed the issue.

gidden added a commit to gidden/pyam that referenced this issue Feb 12, 2019

@nbckr

This comment has been minimized.

Copy link

nbckr commented Feb 12, 2019

Thanks @valdrinium your solution helped. In fact, I didn't even have to adust PATH.

@skleinbo

This comment has been minimized.

Copy link

skleinbo commented Feb 13, 2019

In my case the problem was an older OpenSSL installation from gnuwin32 that was still hanging around in PATH. After removing the stale one and making sure that which openssl yielded c:\anaconda3\Library\bin, conda worked as expected.

@msarahan

This comment has been minimized.

Copy link
Contributor

msarahan commented Feb 13, 2019

The latest builds of Python have a new patch that should help fix this issue, which we believe is a problem with DLL search paths. For the curious, the patch is at https://github.com/AnacondaRecipes/python-feedstock/blob/master/recipe/0020-Add-CondaEcosystemModifyDllSearchPath.patch

The fixed builds of python are:
2.7.15 build 7
3.6.8 build 1
3.7.2 build 2

After updating to these builds, you should be able to remove any workaround that you added to make conda work. As one further workaround to get conda to install an updated python, you can download it manually from https://repo.continuum.io/pkgs/main/win-64/ and tell conda to install the file directly. For example, with python 3.7:

conda install c:\Users\you\Downloads\python-3.7.2-h8c8aaf0_2.tar.bz2

This does not install dependencies for you, so definitely do not try to switch python versions this way (i.e. if you already have 3.7.x, download the 3.7.2 package, not 3.6.8 or 2.7.15).

I'm locking this thread. For any further problems after updating python, please open a new issue and reference this one.

@conda conda locked as resolved and limited conversation to collaborators Feb 13, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.