Skip to content
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

Unable to install latest due to SSL certificate verify failed #1357

Open
gavinmcfarland opened this issue Jul 19, 2019 · 35 comments
Open

Unable to install latest due to SSL certificate verify failed #1357

gavinmcfarland opened this issue Jul 19, 2019 · 35 comments

Comments

@gavinmcfarland
Copy link

gavinmcfarland commented Jul 19, 2019

I'm getting the following error when I try to install using

./emsdk install latest   
Error downloading URL 'https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/osx_32bit/index.txt': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

Error downloading URL 'https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/osx_64bit/index.txt': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

Error downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/f42b12c45fd3f4c20de1321402fbc28f8fd21df1/wasm-binaries.tbz2': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>

Is there a quick workaround for this?

@kripken
Copy link
Member

kripken commented Jul 22, 2019

Using a newer python, or using python3 (which is usually newer) should help.

There are some issue reports on the emsdk repo which might also help, https://github.com/emscripten-core/emsdk/search?q=CERTIFICATE_VERIFY_FAILED&type=Issues

@gavinmcfarland
Copy link
Author

Thanks for the suggestions. :)

@EtherDream
Copy link

$ python --version
Python 3.7.4


$ ./emsdk install latest
Fetching emscripten-releases repository...
Repository 'https://chromium.googlesource.com/emscripten-releases' already cloned to directory '/Users/xxx/tool/emsdk/releases', skipping.
Fetching latest changes to the branch 'master' for '/Users/xxx/tool/emsdk/releases'...
Already up to date.
Successfully updated and checked out branch 'master' on repository '/Users/xxx/tool/emsdk/releases'
Current repository version: "Mon, 19 Aug 2019 05:36:07 +0000 4026f39abdc822ae19b34838439dc793edc37c31"
Fetching all precompiled tagged releases..
Error downloading URL 'https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/osx_32bit/index.txt': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>
Error downloading URL 'https://s3.amazonaws.com/mozilla-games/emscripten/packages/llvm/tag/osx_64bit/index.txt': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>
Installing SDK 'sdk-releases-fastcomp-5c6785a63993ae7a4d5362b32b0be9c85138fb96-64bit'..
Installing tool 'releases-fastcomp-5c6785a63993ae7a4d5362b32b0be9c85138fb96-64bit'..
Error downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/5c6785a63993ae7a4d5362b32b0be9c85138fb96/wasm-binaries.tbz2': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>
Traceback (most recent call last):
  File "./emsdk", line 2756, in <module>
    sys.exit(main())
  File "./emsdk", line 2738, in main
    success = tool.install()
  File "./emsdk", line 1572, in install
    success = tool.install()
  File "./emsdk", line 1588, in install
    success = download_and_unzip(url, self.installation_path(), download_even_if_exists=download_even_if_exists, filename_prefix=filename_prefix)
  File "./emsdk", line 1142, in download_and_unzip
    assert received_download_target == download_target
AssertionError

@sbc100
Copy link
Collaborator

sbc100 commented Aug 19, 2019

emsdk is shell script.. if you want to be sure it running under a given version of python use $ python ./emsdk.py

@Pethaudi
Copy link

(MacOSX 10.14.5)

Using python3 ./emsdk install latest didn't work. Using python 2.7 did work. Maybe try that.

@sbc100
Copy link
Collaborator

sbc100 commented Aug 30, 2019

Can you test again with the latest emsdk. We've made some changes recently.

@Pethaudi
Copy link

Tried it again and it only works with Python2.7.

python3 ./emsdk.py install latest

Installing SDK 'sdk-releases-fastcomp-737d4a07be76c15124adf3c6ef2c218123f7a67f-64bit'..
Installing tool 'releases-fastcomp-737d4a07be76c15124adf3c6ef2c218123f7a67f-64bit'..
Error downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/mac/737d4a07be76c15124adf3c6ef2c218123f7a67f/wasm-binaries.tbz2': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>
Traceback (most recent call last):
File "./emsdk.py", line 2895, in
sys.exit(main())
File "./emsdk.py", line 2875, in main
success = tool.install()
File "./emsdk.py", line 1654, in install
success = tool.install()
File "./emsdk.py", line 1676, in install
success = download_and_unzip(url, self.installation_path(), download_even_if_exists=download_even_if_exists, filename_prefix=filename_prefix)
File "./emsdk.py", line 1216, in download_and_unzip
assert received_download_target == download_target
AssertionError

@Hillsie
Copy link
Contributor

Hillsie commented Sep 17, 2019

I had a similar issue on my mac

<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>

And resolved it with the following steps.

At the terminal:

open /Applications/Python\ 3.7/Install\ Certificates.command

https://stackoverflow.com/a/57614113/6207266

Then

python3 ./emsdk.py install latest

This is a python certificates issue. Note the standard python version is 2.7 on Mac. Suggestion is to have multiple versions of python installed on OSX. Don't mess with the default version of python on mac

https://stackoverflow.com/a/1687456/6207266

Repeated issue, but found this a better solution to
emscripten-core/emscripten#6275

@Krelborn
Copy link

I've just hit this on Catalina. I'm using a brew installed python 2.7.16 which was installed before the OS upgrade.

Anyway running python ./emsdk.py install latest works, while running the emsdk shell script is failing.

I also installed certifi (https://pypi.org/project/certifi/) which was in the link in the warning message from emsdk. Not sure if that actually helped, because I did that before trying to run through python directly.

Anyway, that got me up and running again, but would be interested to know what the right solution is.

@LanFly
Copy link

LanFly commented Feb 6, 2020

I had a similar issue on my MacOSX 10.13.5.

Installing SDK 'sdk-releases-upstream-9a89fff28cc6f75e17976fce1904b280e4beb25d-64bit'..
Installing tool 'node-12.9.1-64bit'..
Error: Downloading URL 'https://storage.googleapis.com/webassembly/emscripten-releases-builds/deps/node-v12.9.1-darwin-x64.tar.gz': <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)>
Warning: Possibly SSL/TLS issue. Update or install Python SSL root certificates (2048-bit or greater) supplied in Python folder or https://pypi.org/project/certifi/ and try again.
Installation failed!

And resolved it with the following steps.

python2.7 ./emsdk.py install latest

only python2.7 was succeed.

@sbc100
Copy link
Collaborator

sbc100 commented Feb 6, 2020

Which version of python3 are you testing against? (What does which python3 say?)

For that matter what does which python and which python2.7 say? Are these all coming from the base system?

@restjohn
Copy link

restjohn commented Mar 6, 2020

Anyway running python ./emsdk.py install latest works, while running the emsdk shell script is failing.

The shell script forces the python interpreter to version 3 before running the python script. Running sudo /Applications/Python\ <VERSION>/Install\ Certificates.command to install the CA certs for python worked for me. I was then able to use ./emsdk install latest.

@Blake-Foust
Copy link

If you're on linux and you run the steps from the original site, in a conda env, it will download! The other solutions didn't work for me.

@robin-rpr
Copy link

robin-rpr commented Mar 26, 2020

$ brew install python3 has done the job for me. (Creates 'python' symlink)

@carrielin007
Copy link

I ran into the same SSL certificate verify failed #1357 issue when tried to run jupyter-lab to launch nltk. The problem is resolved as previous user(@Hillsie ) mentioned to run open /Applications/Python\ /Install\ Certificates.command. I'm using python 3.9 for it.

@mazmazz
Copy link

mazmazz commented Nov 25, 2020

I faced this issue on Windows Server and I fixed it by point Python to the certifi certs via the SSL_CERT_FILE environment variable. Then install succeeded through emsdk.bat.

On PowerShell:

Start-Process -FilePath 'pip' -ArgumentList ('install','certifi') -Wait -NoNewWindow

$certifiPath = & 'python' -c 'import certifi; print(certifi.where())' | Out-String

$env:SSL_CERT_FILE = $certifiPath

I referenced this explanation from RedHat.

Old Notes I attempted to install the certifi certs to Windows' Trusted Root store.

On Powershell:

pip install certifi

$certifiPath = & python -c "import certifi; print(certifi.where())"

Import-Certificate -FilePath "$certifiPath" -CertStoreLocation Cert:\LocalMachine\Root

EDIT: I had trouble reproducing this fix and instead resorted to downloading a cert from Google, see https://pki.goog/repository/ .

$certFile = New-TemporaryFile

Invoke-WebRequest -Uri "https://pki.goog/repo/certs/gsr2.pem" -UseBasicParsing -OutFile $certFile.FullName

Import-Certificate -FilePath $certFile.FullName -CertStoreLocation Cert:\LocalMachine\Root

@ghost
Copy link

ghost commented May 27, 2021

+1, observed this using python 3.9.5 when run within windows container mcr.microsoft.com/dotnet/sdk:5.0-windowsservercore-ltsc2019 (image id e5825ddd3a89)

@sbc100
Copy link
Collaborator

sbc100 commented May 28, 2021

@aaronla-ms do the workaround/tips here work for you?

@ghost
Copy link

ghost commented May 28, 2021

@sbc100 It appears to! Was going to follow up yesterday, but a higher pri issue came up and haven't yet confirmed with a successful build. Will update here when I do.

@teawater
Copy link

Used

sudo pip install --upgrade certifi
python ./emsdk.py install latest

Handle the issue.

@aemooooon
Copy link

I have tried to install Python3 and Python2 both do not solve my problem as well as trying to install certifi. Add the code below to emsdk.py work it for me. Mac os M1 Monterey

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

@basicButtons
Copy link

Thanks, this works for me!

@zoobot
Copy link

zoobot commented Sep 6, 2022

brew uninstall python3
conda create -n m1python3 python=3
conda activate m1python3
worked for me on m1

@steno916
Copy link

I have tried to install Python3 and Python2 both do not solve my problem as well as trying to install certifi. Add the code below to emsdk.py work it for me. Mac os M1 Monterey

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

This worked for me.

@ghost
Copy link

ghost commented Oct 17, 2022

Be advised that ssl._create_unverified_context is in general UNSAFE, and may compromise the security of your developer machine.

@nguyen-van-quang
Copy link

nguyen-van-quang commented Feb 22, 2023

(MacOSX 10.14.5)

Using python3 ./emsdk install latest didn't work. Using python 2.7 did work. Maybe try that.

For me: python ./emsdk.py install latest

(For someone install python on M1: https://dev.to/jordicuevas/how-to-install-python2-in-a-macbook-m1-with-brew-bhi )

Thanks!

@nfer-tazik
Copy link

(MacOSX 10.14.5)

Using python3 ./emsdk install latest didn't work. Using python 2.7 did work. Maybe try that.

Yep, more specifically, this command works:
python ./emsdk.py install latest

@luojinghui
Copy link

I have tried to install Python3 and Python2 both do not solve my problem as well as trying to install certifi. Add the code below to emsdk.py work it for me. Mac os M1 Monterey

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

This worked for me. in MacOS 13.3.1

@tcpdump-examples
Copy link

import ssl
ssl._create_default_https_context = ssl._create_unverified_context
urllib2.urlopen("https://google.com").read()
requests.get('https://github.com', verify='/path/to/certfile')

This worked for me. More info here: https://www.howtouselinux.com/post/ssl-certificate_verify_failed-in-python

@avrdan
Copy link

avrdan commented Aug 16, 2023

I have tried to install Python3 and Python2 both do not solve my problem as well as trying to install certifi. Add the code below to emsdk.py work it for me. Mac os M1 Monterey

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

This worked for me. in MacOS 13.3.1

Thanks for this, also works under linux.

@mosheDO
Copy link

mosheDO commented Sep 13, 2023

For Windows install the certifi package and get the location of the certification

pip install certifi
python -m certifi

### for me it was C:\Python311\Lib\site-packages\certifi\cacert.pem

define in the environment variables SSL_CERT_FILE the path that you got from before

and then open cmd check with the command SET that you see the SSL_CERT_FILE defined
and then run .\emsdk.bat install latest

Hope it will help someone

@HyflerSD
Copy link

I have tried to install Python3 and Python2 both do not solve my problem as well as trying to install certifi. Add the code below to emsdk.py work it for me. Mac os M1 Monterey

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

Worked for me on ubuntu 20.04! Thanks. I just add it to the import section(see screenshot below). then i ran the ./emsdk install latest in the emsdk directory and it worked.
Screenshot from 2023-11-20 22-55-41

@JohnieXu
Copy link

I have tried to install Python3 and Python2 both do not solve my problem as well as trying to install certifi. Add the code below to emsdk.py work it for me. Mac os M1 Monterey

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

This worked for me, MacOS Intel chip

@sbc100 sbc100 transferred this issue from emscripten-core/emscripten Mar 13, 2024
sbc100 added a commit that referenced this issue Mar 14, 2024
sbc100 added a commit that referenced this issue Mar 14, 2024
@sbc100
Copy link
Collaborator

sbc100 commented Mar 14, 2024

Fixed in #1355

@dennisferron
Copy link

Ran into this issue still, June 2024, using latest Msys2 MinGW-64 on Windows 10. (I also wonder if this issue with the certificate is why Chocolatey install for Emscripten failed silently in 2022 or 2023, on a different computer.)

None of the suggested solutions worked until I got to the recommendation to export the SSL_CERT_FILE variable. Exporting the variable seems to be key, on Msys2. For the benefit of anyone reaching here by a web search, here's the commands I believe led to it working, filtering out the things I tried that didn't work:

<install msys2-x86_64-20240507.exe, close default terminal>
<open Msys2 MinGW64 terminal (blue icon)>

pacman -S mingw-w64-x86_64-python
pacman -S mingw-w64-x86_64-python-pip
pip3 install --upgrade certifi
export SSL_CERT_FILE=$(python -m certifi)
python3 emsdk.py install latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests