Open BenjaminPoole opened 2 years ago
I found turning off SSL verification solved this for me
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
Moving issue to https://github.com/pytorch/vision
Internally, we do something like
from torchvision.datasets.utils import download_and_extract_archive
download_and_extract_archive(
"https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz",
".",
md5="c58f30108f718f92721af3b95e74349a",
)
This works for me without modifying SSL in any form:
>>> import ssl
>>> ssl._create_default_https_context
>>> <function create_default_context at 0x7f354d653950>
The only thing that stands out from the envs posted here and in #6007 is that they are Windows builds. I'll try to reproduce in a VM.
Any status update on this? My students are hitting this frequently.
So far I'm unable to reproduce this with this VM. @rsokl if you or your students are
hitting this frequently
would you be able to either debug this or compile a minimal example / setup I can use to reproduce?
I have been getting similar error but fixed it with the recommendation from @pmeier, but instead of adding the ssl script like he suggested, editing the Pytorch library url has worked for me. In the library the url has a value of "https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz". To bypass the error we just have to change the url to one with out the ssl, http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz. To do this:
torchvision.datasets.CIFAR10.url="http://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz"
then the torch vision data download should work fine without error.
all_images = torchvision.datasets.CIFAR10(train=True, root="data",download=True)
I found turning off SSL verification solved this for me
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
Hi Benjamin, this solution worked for me as well, thanks
Faced this issue recently. The url doesn't seem to work anymore.
torchvision.datasets.CIFAR10.url="https://data.brainchip.com/dataset-mirror/cifar10/cifar-10-python.tar.gz"
Updating the url to the above works.
🐛 Bug
Trying to download CIFAR-10 from torchvision.datasets and receiving
URLError:<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129)> when downloading
Download failsTo Reproduce
Steps to reproduce the behavior:
dataset = torchvision.datasets.CIFAR10(root='dataset/',train=True,transform=transform,download=True)
Expected behavior
Pre-trained models should be downloaded without certificate failures
Environment
PyTorch version: 1.9.1+cu111 Is debug build: False CUDA used to build PyTorch: 11.1 ROCM used to build PyTorch: N/A
OS: Microsoft Windows 10 Pro GCC version: Could not collect Clang version: Could not collect CMake version: Could not collect Libc version: N/A
Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] (64-bit runtime) Python platform: Windows-10-10.0.19044-SP0 Is CUDA available: True CUDA runtime version: 11.2.67
GPU models and configuration: GPU 0: NVIDIA GeForce GT 1030 Nvidia driver version: 465.89 cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin\cudnn_ops_train64_8.dll HIP runtime version: N/A MIOpen runtime version: N/A
Versions of relevant libraries: [pip3] numpy==1.19.5
[pip3] pytorch-lightning==1.5.1
[pip3] torch==1.9.1+cu111
[pip3] torch-tb-profiler==0.2.1
[pip3] torchaudio==0.9.1
[pip3] torchmetrics==0.6.0
[pip3] torchvision==0.10.1+cu111
cc @pmeier @YosuaMichael @fmassa @vfdev-5