Skip to content

[Bug]: SSL certificate verification failure during 'anomalib train' on Ubuntu #3477

Description

@wenyanta

Describe the bug

When running the anomalib train command for the first time, the process fails during the automatic dataset download phase. Python is unable to verify the SSL certificate of the host server, resulting in a URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]

Dataset

MVTecAD

Model

PatchCore

Steps to reproduce the behavior

Steps to reproduce the behavior:

  1. mkdir anomalib && cd anomalib
  2. python3 -m venv venv && source venv/bin/activate
  3. pip install anomalib
  4. anomalib train --model Patchcore --data anomalib.data.MVTecAD --data.category transistor

OS information

OS information:

  • OS: Ubuntu 24.04.4
  • Python version: 3.12.3
  • Anomalib version: 2.3.1
  • GPU models and configuration: 00:02.0 VGA compatible controller [0300]: Intel Corporation Device [8086:b082] (rev 04)

Proxy information:

Expected behavior

The MVTecAD dataset (transistor category) should download successfully from the remote server and proceed to the training phase.

Screenshots

No response

Pip/GitHub

pip

What version/branch did you use?

main

Configuration YAML

N/A

Logs

(venv) user@user-Panther-Lake-Client-Platform:~/anomalib$ anomalib train --model Patchcore --data anomalib.data.MVTecAD --data.category transistor
2026-03-27 00:35:21,835 - anomalib.cli.utils.openvino - INFO - OpenVINO is possibly not installed in the environment. Skipping adding it to parser.
[03/27/26 00:35:21] INFO     OpenVINO is possibly not installed in the environment. Skipping adding it to parser.                               openvino.py:71
2026-03-27 00:35:21,887 - anomalib.models.components.base.anomalib_module - INFO - Initializing Patchcore model.
                    INFO     Initializing Patchcore model.                                                                              anomalib_module.py:131
2026-03-27 00:35:22,557 - timm.models._builder - INFO - Loading pretrained weights from Hugging Face hub (timm/wide_resnet50_2.racm_in1k)
[03/27/26 00:35:22] INFO     Loading pretrained weights from Hugging Face hub (timm/wide_resnet50_2.racm_in1k)                                 _builder.py:217
2026-03-27 00:35:22,916 - httpx - INFO - HTTP Request: HEAD https://huggingface.co/timm/wide_resnet50_2.racm_in1k/resolve/main/model.safetensors "HTTP/1.1 302 Found"
                    INFO     HTTP Request: HEAD https://huggingface.co/timm/wide_resnet50_2.racm_in1k/resolve/main/model.safetensors "HTTP/1.1 _client.py:1025
                             302 Found"
2026-03-27 00:35:22,918 - timm.models._hub - INFO - [timm/wide_resnet50_2.racm_in1k] Safe alternative available for 'pytorch_model.bin' (as 'model.safetensors'). Loading weights using safetensors.
                    INFO     [timm/wide_resnet50_2.racm_in1k] Safe alternative available for 'pytorch_model.bin' (as 'model.safetensors'). Loading _hub.py:233
                             weights using safetensors.
2026-03-27 00:35:22,999 - timm.models._builder - INFO - Missing keys (fc.weight, fc.bias) discovered while loading pretrained weights. This is expected if model is being adapted.
                    INFO     Missing keys (fc.weight, fc.bias) discovered while loading pretrained weights. This is expected if model is being _builder.py:282
                             adapted.
2026-03-27 00:35:23,009 - anomalib.callbacks - INFO - Loading the callbacks
[03/27/26 00:35:23] INFO     Loading the callbacks                                                                                             __init__.py:114
2026-03-27 00:35:23,010 - anomalib.engine.engine - INFO - Overriding gradient_clip_val from None with 0 for Patchcore
                    INFO     Overriding gradient_clip_val from None with 0 for Patchcore                                                         engine.py:102
2026-03-27 00:35:23,010 - anomalib.engine.engine - INFO - Overriding max_epochs from None with 1 for Patchcore
                    INFO     Overriding max_epochs from None with 1 for Patchcore                                                                engine.py:102
2026-03-27 00:35:23,011 - anomalib.engine.engine - INFO - Overriding num_sanity_val_steps from None with 0 for Patchcore
                    INFO     Overriding num_sanity_val_steps from None with 0 for Patchcore                                                      engine.py:102
2026-03-27 00:35:23,011 - anomalib.engine.engine - INFO - Overriding devices from auto with 1 for Patchcore
                    INFO     Overriding devices from auto with 1 for Patchcore                                                                   engine.py:102
GPU available: False, used: False
TPU available: False, using: 0 TPU cores
💡 Tip: For seamless cloud logging and experiment tracking, try installing [litlogger](https://pypi.org/project/litlogger/) to enable LitLogger, which logs metrics and artifacts automatically to the Lightning Experiments platform.
2026-03-27 00:35:23,016 - anomalib.data.utils.download - INFO - Downloading the mvtecad dataset.
                    INFO     Downloading the mvtecad dataset.                                                                                  download.py:308
mvtecad: 0.00B [00:00, ?B/s]

SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)

During handling of the above exception, another exception occurred:

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)>

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions