[英]Python: Ssl Certificate verify failed
I have installed dvc
on my ubuntu-18.04-LTS
system and while trying to download the data
files from github using dvc, it fails with below error.我已经在我的
ubuntu-18.04-LTS
系统上安装了dvc
,在尝试使用 dvc 从 github 下载data
文件时,它失败并出现以下错误。
$ dvc get https://github.com/iterative/dataset-registry get-started/data.xml -o data/data.xml -v
2022-07-22 12:55:22,260 DEBUG: Creating external repo https://github.com/iterative/dataset-registry@None
2022-07-22 12:55:22,260 DEBUG: erepo: git clone 'https://github.com/iterative/dataset-registry' to a temporary dir
2022-07-22 12:55:23,683 DEBUG: Removing '/dvc/dvc_test/data/.UEeAzwmJCY3q85YQuCeahx'
2022-07-22 12:55:23,684 ERROR: failed to get 'get-started/data.xml' from 'https://github.com/iterative/dataset-registry' - Failed to clone repo 'https://github.com/iterative/dataset-registry' to '/tmp/tmpvmrmu9qsdvc-clone'
------------------------------------------------------------
Traceback (most recent call last):
File "urllib3/connectionpool.py", line 703, in urlopen
File "urllib3/connectionpool.py", line 386, in _make_request
File "urllib3/connectionpool.py", line 1042, in _validate_conn
File "urllib3/connection.py", line 414, in connect
File "urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
File "urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
File "ssl.py", line 500, in wrap_socket
File "ssl.py", line 1040, in _create
File "ssl.py", line 1309, in do_handshake
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "dvc/scm.py", line 145, in clone
File "scmrepo/git/__init__.py", line 143, in clone
File "scmrepo/git/backend/dulwich/__init__.py", line 199, in clone
scmrepo.exceptions.CloneError: Failed to clone repo 'https://github.com/iterative/dataset-registry' to '/tmp/tmpvmrmu9qsdvc-clone'
Already our corporate proxy certificate has been installed and traffic to github.com
allowed I'm able to clone above repository separately on CLI.已经安装了我们的公司代理证书,并且允许到
github.com
的流量我可以在 CLI 上单独克隆上述存储库。 But with dvc
the above errors are occurring, Even the below couldn't solve the issue.但是使用
dvc
会出现上述错误,即使是下面的也无法解决问题。
$ python -c "import ssl; print(ssl.get_default_verify_paths())"
DefaultVerifyPaths(cafile=None, capath='/usr/lib/ssl/certs', openssl_cafile_env='SSL_CERT_FILE', openssl_cafile='/usr/lib/ssl/cert.pem', openssl_capath_env='SSL_CERT_DIR', openssl_capath='/usr/lib/ssl/certs')
export SSL_CERT_DIR=/etc/ssl/certs/
export REQUESTS_CA_BUNDLE=/usr/local/lib/python2.7/dist-packages/certifi/cacert.pem
pip install --upgrade certifi
export PYTHONHTTPSVERIFY=0
sudo apt install ca-certificates
sudo update-ca-certificates --fresh
$ python --version
Python 2.7.17
$ dvc doctor
DVC version: 2.13.0 (deb)
---------------------------------
Platform: Python 3.8.3 on Linux-5.4.0-92-generic-x86_64-with-glibc2.14
Supports:
azure (adlfs = 2022.7.0, knack = 0.9.0, azure-identity = 1.10.0),
gdrive (pydrive2 = 1.10.1),
gs (gcsfs = 2022.5.0),
hdfs (fsspec = 2022.5.0, pyarrow = 8.0.0),
webhdfs (fsspec = 2022.5.0),
http (aiohttp = 3.8.1, aiohttp-retry = 2.5.1),
https (aiohttp = 3.8.1, aiohttp-retry = 2.5.1),
s3 (s3fs = 2022.5.0, boto3 = 1.21.21),
ssh (sshfs = 2022.6.0),
oss (ossfs = 2021.8.0),
webdav (webdav4 = 0.9.7),
webdavs (webdav4 = 0.9.7)
Tp bypass the ssl validation in git we have git config http.sslVerify "false"
Similarly do we have option in dvc? Tp bypass the ssl validation in git we have
git config http.sslVerify "false"
Similarly do we have option in dvc?
Further what should i update to resolve this issue?此外,我应该更新什么来解决这个问题?
The Python environment you're applying fixes to is not the one DVC is using.您正在应用修复的 Python 环境不是 DVC 正在使用的环境。 Your Python version is 2.7.17, while DVC is using Python 3.8.3.
您的 Python 版本是 2.7.17,而 DVC 使用的是 Python 3.8.3。
It looks like you installed the Debian Linux package ;看起来您安装了 Debian Linux package ; Please figure out what
python
binary that is using and fix the certs for that env.请找出正在使用的
python
二进制文件并修复该环境的证书。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.