question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

Can not download pre-trained models because SSL certificate has expired

See original GitHub issue

๐Ÿ› Describe the bug

The SSL certificate of the download.pytorch.org domain has expired, and it is no longer possible to download the pre-trained models.

Code:

import torch
import torchvision

model = torchvision.models.resnet50(pretrained=True)

Error message:

Downloading: "https://download.pytorch.org/models/resnet50-0676ba61.pth" to /root/.cache/torch/hub/checkpoints/resnet50-0676ba61.pth
---------------------------------------------------------------------------
SSLCertVerificationError                  Traceback (most recent call last)
[/usr/lib/python3.7/urllib/request.py](https://localhost:8080/#) in do_open(self, http_class, req, **http_conn_args)
   1349                 h.request(req.get_method(), req.selector, req.data, headers,
-> 1350                           encode_chunked=req.has_header('Transfer-encoding'))
   1351             except OSError as err: # timeout error

19 frames
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)

During handling of the above exception, another exception occurred:

URLError                                  Traceback (most recent call last)
[/usr/lib/python3.7/urllib/request.py](https://localhost:8080/#) in do_open(self, http_class, req, **http_conn_args)
   1350                           encode_chunked=req.has_header('Transfer-encoding'))
   1351             except OSError as err: # timeout error
-> 1352                 raise URLError(err)
   1353             r = h.getresponse()
   1354         except:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1091)>

Versions

Collecting environment information...
PyTorch version: 1.10.0+cu111
Is debug build: False
CUDA used to build PyTorch: 11.1
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.5 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
CMake version: version 3.12.0
Libc version: glibc-2.26

Python version: 3.7.13 (default, Mar 16 2022, 17:37:17)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.4.144+-x86_64-with-Ubuntu-18.04-bionic
Is CUDA available: False
CUDA runtime version: 11.1.105
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.7.6.5
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.0.5
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.21.5
[pip3] torch==1.10.0+cu111
[pip3] torchaudio==0.10.0+cu111
[pip3] torchsummary==1.5.1
[pip3] torchtext==0.11.0
[pip3] torchvision==0.11.1+cu111
[conda] Could not collect

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
RahulBhalleycommented, Apr 3, 2022

Thank you! ๐Ÿ˜ƒ

1reaction
taesiricommented, Apr 3, 2022

@RahulBhalley Check the error message, and you will see the full URL of the model.

In your case (your issue):

Downloading: "https://download.pytorch.org/models/alexnet-owt-7be5be79.pth" to /Users/me/.cache/torch/hub/checkpoints/alexnet-owt-7be5be79.pth
Read more comments on GitHub >

github_iconTop Results From Across the Web

SSL certificate problem when using wptools - Stack Overflow
I am getting the following error message when using wptools on Jupyter on Udacity. error: (60, 'SSL certificate problem: certificate has expired ...
Read more >
Resolve the "InvalidViewerCertificate" error exception when ...
This error message indicates that one or more of the certificate chains are expired in the certificate that CloudFront is trying to use....
Read more >
SSL certificates overview | Load Balancing - Google Cloud
Learn how SSL certificates are used to secure communications with Google Cloud load balancers.
Read more >
Torchvision URL error when loading pretrained model - vision
Hi. I'm trying to load a pretrained vgg16 with: cnn = torchvision.models.vgg19(pretrained=True) But I get the following error: Downloading: ...
Read more >
pretrained-models.pytorch - Bountysource
I am getting an SSL Error trying to load ImageNet weights for the SEResNeXt50 & 101 models. Perhaps there is an expired certificate?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found