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:
- [Solved] urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
- Error when downloading the built-in dataset of pytoch = urllib.error.urlerror: urlopen error [SSL: certificate_verify_failed]
- urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution>
- [Solved] Pytorch Download CIFAR1 Datas Error: urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certi
- PIP Install Caused by SSLError(SSLError(1, ‘[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1123)’))
- [Solved] raise ContentTooShortError(urllib.error.ContentTooShortError: <urlopen error retrieval incomplete:
- [Solved] Error: [email protected]: wrong number of arguments (given 1, expected 0)
- Python 3 urllib has no URLEncode attribute
- SSL error of urllib3 when Python uploads files using Minio
- [Solved]AttributeError: module ‘urllib’ has no attribute ‘quote’
- urllib.error.HTTPError: HTTP Error 403: Forbidden [How to Solve]
- Python error: urllib.error.HTTPError : http Error 404: not found
- urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=‘localhost‘, port=8097): Max retries excee
- python chatterbot [nltk_data] Error loading stopwords: <urlopen error [Errno 11004]
- urllib.error.HTTPError http error 403 forbidden
- Using Python error urlopen error unknown URL type: the solution of HTTPS
- Set the maximum number of Postgres connections Error [How to Solve]