emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
3.07k stars 699 forks source link

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

Open gavinmcfarland opened 5 years ago

gavinmcfarland commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Thanks for the suggestions. :)

EtherDream commented 5 years ago
$ 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 commented 5 years ago

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

Pethaudi commented 5 years ago

(MacOSX 10.14.5)

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

sbc100 commented 5 years ago

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

Pethaudi commented 5 years ago

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 commented 5 years ago

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 https://github.com/emscripten-core/emscripten/issues/6275

Krelborn commented 5 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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.

vnosis commented 4 years ago

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 commented 4 years ago

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

carrielin007 commented 4 years ago

I ran into the same SSL certificate verify failed emscripten-core/emsdk#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 commented 4 years ago

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: ```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/ . ```powershell $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 commented 3 years ago

+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 commented 3 years ago

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

ghost commented 3 years ago

@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 commented 2 years ago

Used

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

Handle the issue.

aemooooon commented 2 years ago

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 commented 2 years ago

Thanks, this works for me!

zoobot commented 2 years ago

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

steno916 commented 2 years ago

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 commented 2 years ago

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

nguyen-van-quang commented 1 year ago

(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 commented 1 year ago

(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 commented 1 year ago

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 commented 1 year ago
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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 10 months ago

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 commented 8 months ago

Fixed in #1355

dennisferron commented 5 months ago

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