There are totally four methods to solve this error
Solution:
Method 1: the SSL certificate problem
you can open the URL with the following code
import ssl
# This restores the same behavior as before.
context = ssl._create_unverified_context()
response = urllib.request.urlopen("https://no-valid-cert", context=context)
https://no-valid-cert
you can change it to the website you want
Method 2: Change https to http, because some versions of python verify the SSL certificate once when you urllib.urlopen an https.
Method 3: Add the following codes:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
I just add it to the py file when calling commands from the urllib library that comes with python 3.8.0
model = ALBEF(config=config, text_encoder=args.text_encoder, tokenizer=tokenizer, init_deit=True)
That is, when the model is initialized (init_deit), the error occurs when calling return self.sslsocket_class._create
in lib/python3.8/http/client.py under python 3.8, but at the beginning of the py file for initializing the model Add these two lines and you’ll be fine
Method 4:
Upgrade your python interpreter version, e.g. 2.7 or 3.7 to 3.8 or even 3.9
Read More:
- python3 ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833) Error
- [Solved] urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
- Python 3 urllib has no URLEncode attribute
- urllib.error.HTTPError: HTTP Error 403: Forbidden [How to Solve]
- [Solved] Pytorch Download CIFAR1 Datas Error: urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certi
- Python: How to Disable InsecureRequestWarning error
- How to Fix “HTTP error 403: forbidden” in Python 3. X
- [Solved] Pytorch-transformers Error: AttributeError: ‘str‘ object has no attribute ‘shape‘
- Extracting Data from XML (Using Python to Access Web Data)
- from keras.preprocessing.text import Tokenizer error: AttributeError: module ‘tensorflow.compat.v2‘ has..
- urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
- Python error: urllib.error.HTTPError : http Error 404: not found
- [Solved] HTTPError: 404 Client Error: Not Found for url: https://huggingface.co/saved_model
- SSL error of urllib3 when Python uploads files using Minio
- Error when downloading the built-in dataset of pytoch = urllib.error.urlerror: urlopen error [SSL: certificate_verify_failed]
- [Solved]AttributeError: module ‘urllib’ has no attribute ‘quote’
- linux ubuntu pip search Fault: <Fault -32500: “RuntimeError: PyPI‘s XMLRPC API is currently disab
- Crawler overtime error socket.timeout: timed out/NameError: name ‘socket‘ is not defined
- How to Solve Python ImportError: cannot import name UnrewindableBodyError