pytorch - 💡(How to fix) Fix SSL: CERTIFICATE_VERIFY_FAILED when installing torchvision in Docker from download.pytorch.org [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
pytorch/pytorch#177638Fetched 2026-04-08 00:47:03
View on GitHub
Comments
4
Participants
3
Timeline
25
Reactions
0
Author
Assignees
Timeline (top)
labeled ×6mentioned ×6subscribed ×6commented ×4

Error Message

docker build . [+] Building 37.1s (6/6) FINISHED docker:desktop-linux => [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 170B 0.0s => [internal] load metadata for docker.io/library/python:3.9.14-slim 1.7s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [1/3] FROM docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376 23.3s => => resolve docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376 0.0s => => sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b 1.08MB / 1.08MB 2.8s => => sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f 11.59MB / 11.59MB 15.1s => => sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376 1.86kB / 1.86kB 0.0s => => sha256:30de029e44d58ef76c39fdaaad2ced2983a6e5826000fd219c5670ce4f50059e 1.37kB / 1.37kB 0.0s => => sha256:750c02c33a2cc0be6bc9bd33f89c911da450ff067e227fd7153137861403b820 7.48kB / 7.48kB 0.0s => => sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05 31.42MB / 31.42MB 19.8s => => sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d 233B / 233B 3.3s => => sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c 3.18MB / 3.18MB 9.4s => => extracting sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05 2.0s => => extracting sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b 0.1s => => extracting sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f 0.6s => => extracting sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d 0.0s => => extracting sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c 0.3s => [2/3] WORKDIR /app 0.4s => ERROR [3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128 11.6s


[3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128: 1.645 Looking in indexes: https://download.pytorch.org/whl/cu128 2.383 Collecting torchvision==0.23.0+cu128 2.574 WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl 3.237 WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl 4.402 WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl 6.564 WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl 10.73 WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl 10.89 ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='download-r2.pytorch.org', port=443): Max retries exceeded with url: /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))) 10.89


Dockerfile:3

1 | FROM python:3.9.14-slim 2 | WORKDIR /app 3 | >>> RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128

ERROR: failed to build: failed to solve: process "/bin/sh -c pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128" did not complete successfully: exit code: 1

Root Cause

The docker build command fails with the following error and traceback:

> docker build .
[+] Building 37.1s (6/6) FINISHED                                                                                                         docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                      0.0s
 => => transferring dockerfile: 170B                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/python:3.9.14-slim                                                                                     1.7s
 => [internal] load .dockerignore                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                           0.0s
 => [1/3] FROM docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376                              23.3s
 => => resolve docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376                               0.0s
 => => sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b 1.08MB / 1.08MB                                                            2.8s
 => => sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f 11.59MB / 11.59MB                                                         15.1s
 => => sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376 1.86kB / 1.86kB                                                            0.0s
 => => sha256:30de029e44d58ef76c39fdaaad2ced2983a6e5826000fd219c5670ce4f50059e 1.37kB / 1.37kB                                                            0.0s
 => => sha256:750c02c33a2cc0be6bc9bd33f89c911da450ff067e227fd7153137861403b820 7.48kB / 7.48kB                                                            0.0s
 => => sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05 31.42MB / 31.42MB                                                         19.8s
 => => sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d 233B / 233B                                                                3.3s
 => => sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c 3.18MB / 3.18MB                                                            9.4s
 => => extracting sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05                                                                 2.0s
 => => extracting sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b                                                                 0.1s
 => => extracting sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f                                                                 0.6s
 => => extracting sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d                                                                 0.0s
 => => extracting sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c                                                                 0.3s
 => [2/3] WORKDIR /app                                                                                                                                    0.4s
 => ERROR [3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128                                             11.6s
------
 > [3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128:
1.645 Looking in indexes: https://download.pytorch.org/whl/cu128
2.383 Collecting torchvision==0.23.0+cu128
2.574   WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
3.237   WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
4.402   WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
6.564   WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
10.73   WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
10.89 ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='download-r2.pytorch.org', port=443): Max retries exceeded with url: /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
10.89
------
Dockerfile:3
--------------------
   1 |     FROM python:3.9.14-slim
   2 |     WORKDIR /app
   3 | >>> RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128" did not complete successfully: exit code: 1

Fix Action

Fix / Workaround

CPU: Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 46 bits physical, 48 bits virtual CPU(s): 24 On-line CPU(s) list: 0-23 Thread(s) per core: 2 Core(s) per socket: 12 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 85 Model name: Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz Stepping: 7 CPU MHz: 3504.000 BogoMIPS: 7008.00 Virtualization: VT-x Hypervisor vendor: Microsoft Virtualization type: full L1d cache: 384 KiB L1i cache: 384 KiB L2 cache: 12 MiB L3 cache: 19.3 MiB NUMA node0 CPU(s): 0-23 Vulnerability Gather data sampling: Not affected Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled Vulnerability L1tf: Not affected Vulnerability Mds: Not affected Vulnerability Meltdown: Not affected Vulnerability Mmio stale data: Mitigation; Clear CPU buffers; SMT Host state unknown Vulnerability Reg file data sampling: Not affected Vulnerability Retbleed: Mitigation; Enhanced IBRS Vulnerability Spec rstack overflow: Not affected Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop Vulnerability Srbds: Not affected Vulnerability Tsx async abort: Mitigation; TSX disabled Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves vnmi avx512_vnni md_clear flush_l1d arch_capabilities

Code Example

FROM python:3.9.14-slim
WORKDIR /app
RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128

---

docker build .

---

> docker build .
[+] Building 37.1s (6/6) FINISHED                                                                                                         docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                      0.0s
 => => transferring dockerfile: 170B                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/python:3.9.14-slim                                                                                     1.7s
 => [internal] load .dockerignore                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                           0.0s
 => [1/3] FROM docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376                              23.3s
 => => resolve docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376                               0.0s
 => => sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b 1.08MB / 1.08MB                                                            2.8s
 => => sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f 11.59MB / 11.59MB                                                         15.1s
 => => sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376 1.86kB / 1.86kB                                                            0.0s
 => => sha256:30de029e44d58ef76c39fdaaad2ced2983a6e5826000fd219c5670ce4f50059e 1.37kB / 1.37kB                                                            0.0s
 => => sha256:750c02c33a2cc0be6bc9bd33f89c911da450ff067e227fd7153137861403b820 7.48kB / 7.48kB                                                            0.0s
 => => sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05 31.42MB / 31.42MB                                                         19.8s
 => => sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d 233B / 233B                                                                3.3s
 => => sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c 3.18MB / 3.18MB                                                            9.4s
 => => extracting sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05                                                                 2.0s
 => => extracting sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b                                                                 0.1s
 => => extracting sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f                                                                 0.6s
 => => extracting sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d                                                                 0.0s
 => => extracting sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c                                                                 0.3s
 => [2/3] WORKDIR /app                                                                                                                                    0.4s
 => ERROR [3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128                                             11.6s
------
 > [3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128:
1.645 Looking in indexes: https://download.pytorch.org/whl/cu128
2.383 Collecting torchvision==0.23.0+cu128
2.574   WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
3.237   WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
4.402   WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
6.564   WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
10.73   WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
10.89 ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='download-r2.pytorch.org', port=443): Max retries exceeded with url: /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
10.89
------
Dockerfile:3
--------------------
   1 |     FROM python:3.9.14-slim
   2 |     WORKDIR /app
   3 | >>> RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128" did not complete successfully: exit code: 1

---

# curl -sL https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py | python
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux 11 (bullseye) (x86_64)
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.9.14 (main, Oct  5 2022, 15:22:07)  [GCC 10.2.1 20210110] (64-bit runtime)
Python platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.31
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 5080
Nvidia driver version: 591.74
cuDNN version: Could not collect
Is XPU available: N/A
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A
Caching allocator config: N/A

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Byte Order:                           Little Endian
Address sizes:                        46 bits physical, 48 bits virtual
CPU(s):                               24
On-line CPU(s) list:                  0-23
Thread(s) per core:                   2
Core(s) per socket:                   12
Socket(s):                            1
NUMA node(s):                         1
Vendor ID:                            GenuineIntel
CPU family:                           6
Model:                                85
Model name:                           Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz
Stepping:                             7
CPU MHz:                              3504.000
BogoMIPS:                             7008.00
Virtualization:                       VT-x
Hypervisor vendor:                    Microsoft
Virtualization type:                  full
L1d cache:                            384 KiB
L1i cache:                            384 KiB
L2 cache:                             12 MiB
L3 cache:                             19.3 MiB
NUMA node0 CPU(s):                    0-23
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          KVM: Mitigation: VMX disabled
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT Host state unknown
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Mitigation; TSX disabled
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves vnmi avx512_vnni md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] No relevant packages
[conda] Could not collect
RAW_BUFFERClick to expand / collapse

🐛 Describe the bug

When attempting to build a Docker image that installs torchvision from the official PyTorch wheel index (https://download.pytorch.org/whl/cu128), the build process fails with an SSL: CERTIFICATE_VERIFY_FAILED error. This indicates a problem with SSL certificate verification when pip tries to connect to the download server (download.pytorch.org and its redirect download-r2.pytorch.org). This issue started occurring recently without any changes to the Dockerfile.

To Reproduce The error can be reproduced with a minimal Dockerfile and the docker build command.

FROM python:3.9.14-slim
WORKDIR /app
RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128
docker build .

The docker build command fails with the following error and traceback:

> docker build .
[+] Building 37.1s (6/6) FINISHED                                                                                                         docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                      0.0s
 => => transferring dockerfile: 170B                                                                                                                      0.0s
 => [internal] load metadata for docker.io/library/python:3.9.14-slim                                                                                     1.7s
 => [internal] load .dockerignore                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                           0.0s
 => [1/3] FROM docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376                              23.3s
 => => resolve docker.io/library/python:3.9.14-slim@sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376                               0.0s
 => => sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b 1.08MB / 1.08MB                                                            2.8s
 => => sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f 11.59MB / 11.59MB                                                         15.1s
 => => sha256:be8c64a08749503880e77755a1089272d4a201e395142aabd4bab54e7f547376 1.86kB / 1.86kB                                                            0.0s
 => => sha256:30de029e44d58ef76c39fdaaad2ced2983a6e5826000fd219c5670ce4f50059e 1.37kB / 1.37kB                                                            0.0s
 => => sha256:750c02c33a2cc0be6bc9bd33f89c911da450ff067e227fd7153137861403b820 7.48kB / 7.48kB                                                            0.0s
 => => sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05 31.42MB / 31.42MB                                                         19.8s
 => => sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d 233B / 233B                                                                3.3s
 => => sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c 3.18MB / 3.18MB                                                            9.4s
 => => extracting sha256:bd159e379b3b1bc0134341e4ffdeab5f966ec422ae04818bb69ecef08a823b05                                                                 2.0s
 => => extracting sha256:de08aeb7fd50562d57cef1a49d6197d619df0b4ce52e4caeba2402c27c6e536b                                                                 0.1s
 => => extracting sha256:ac24a0a1f4114c10ddde7597a8926b0913f62cf5cea2f6f2135f02f72516285f                                                                 0.6s
 => => extracting sha256:bc2df719f1a864827b2b594f59d1ef9fb5b0577df40d61b52173c54e3bb5f95d                                                                 0.0s
 => => extracting sha256:8dded29385797302c49342d343e501ac7c7117cb2ec21ba0675de023443be14c                                                                 0.3s
 => [2/3] WORKDIR /app                                                                                                                                    0.4s
 => ERROR [3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128                                             11.6s
------
 > [3/3] RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128:
1.645 Looking in indexes: https://download.pytorch.org/whl/cu128
2.383 Collecting torchvision==0.23.0+cu128
2.574   WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
3.237   WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
4.402   WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
6.564   WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
10.73   WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)'))': /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl
10.89 ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='download-r2.pytorch.org', port=443): Max retries exceeded with url: /whl/cu128/torchvision-0.23.0%2Bcu128-cp39-cp39-manylinux_2_28_x86_64.whl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))
10.89
------
Dockerfile:3
--------------------
   1 |     FROM python:3.9.14-slim
   2 |     WORKDIR /app
   3 | >>> RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128
--------------------
ERROR: failed to build: failed to solve: process "/bin/sh -c pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128" did not complete successfully: exit code: 1

Versions

# curl -sL https://raw.githubusercontent.com/pytorch/pytorch/main/torch/utils/collect_env.py | python
Collecting environment information...
PyTorch version: N/A
Is debug build: N/A
CUDA used to build PyTorch: N/A
ROCM used to build PyTorch: N/A

OS: Debian GNU/Linux 11 (bullseye) (x86_64)
GCC version: Could not collect
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.9.14 (main, Oct  5 2022, 15:22:07)  [GCC 10.2.1 20210110] (64-bit runtime)
Python platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.31
Is CUDA available: N/A
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 5080
Nvidia driver version: 591.74
cuDNN version: Could not collect
Is XPU available: N/A
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: N/A
Caching allocator config: N/A

CPU:
Architecture:                         x86_64
CPU op-mode(s):                       32-bit, 64-bit
Byte Order:                           Little Endian
Address sizes:                        46 bits physical, 48 bits virtual
CPU(s):                               24
On-line CPU(s) list:                  0-23
Thread(s) per core:                   2
Core(s) per socket:                   12
Socket(s):                            1
NUMA node(s):                         1
Vendor ID:                            GenuineIntel
CPU family:                           6
Model:                                85
Model name:                           Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz
Stepping:                             7
CPU MHz:                              3504.000
BogoMIPS:                             7008.00
Virtualization:                       VT-x
Hypervisor vendor:                    Microsoft
Virtualization type:                  full
L1d cache:                            384 KiB
L1i cache:                            384 KiB
L2 cache:                             12 MiB
L3 cache:                             19.3 MiB
NUMA node0 CPU(s):                    0-23
Vulnerability Gather data sampling:   Not affected
Vulnerability Itlb multihit:          KVM: Mitigation: VMX disabled
Vulnerability L1tf:                   Not affected
Vulnerability Mds:                    Not affected
Vulnerability Meltdown:               Not affected
Vulnerability Mmio stale data:        Mitigation; Clear CPU buffers; SMT Host state unknown
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed:               Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow:   Not affected
Vulnerability Spec store bypass:      Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:             Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:             Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI SW loop, KVM SW loop
Vulnerability Srbds:                  Not affected
Vulnerability Tsx async abort:        Mitigation; TSX disabled
Flags:                                fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves vnmi avx512_vnni md_clear flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] No relevant packages
[conda] Could not collect

cc @seemethere @malfet @atalman @tinglvv @nWEIdia

extent analysis

Fix Plan

The issue is caused by an SSL certificate verification error when pip tries to connect to the download server. To fix this, we can disable SSL verification for the pip install command.

Here are the steps:

  • Update the Dockerfile to include the --trusted-host option for pip:
FROM python:3.9.14-slim
WORKDIR /app
RUN pip install --trusted-host download.pytorch.org --trusted-host download-r2.pytorch.org torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128

Alternatively, you can also use the --trusted-host option with the pip config command to set the trusted hosts globally:

FROM python:3.9.14-slim
WORKDIR /app
RUN pip config set global.trusted-hosts download.pytorch.org download-r2.pytorch.org
RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128

Verification

To verify that the fix worked, you can try building the Docker image again and check if the pip install command succeeds.

Extra Tips

  • Disabling SSL verification can pose a security risk, so it's recommended to only use this fix as a temporary workaround until the underlying issue is resolved.
  • You can also try updating the ca-certificates package in the Docker image to ensure that the latest SSL certificates are installed:
FROM python:3.9.14-slim
WORKDIR /app
RUN apt-get update && apt-get install -y ca-certificates
RUN pip install torchvision==0.23.0+cu128 --index-url https://download.pytorch.org/whl/cu128

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

pytorch - 💡(How to fix) Fix SSL: CERTIFICATE_VERIFY_FAILED when installing torchvision in Docker from download.pytorch.org [4 comments, 3 participants]