From 2d725b89c5257378fc4b64b7f9134855f8c54590 Mon Sep 17 00:00:00 2001 From: Jeffrey Wang Date: Tue, 31 Mar 2026 22:31:20 -0700 Subject: [PATCH] [Bugfix] Lazy import diskcache to avoid sqlite3/libstdc++ ImportError at startup (#38649) Signed-off-by: Jeffrey Wang --- vllm/v1/structured_output/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vllm/v1/structured_output/utils.py b/vllm/v1/structured_output/utils.py index 9fc1accb2..f149ae845 100644 --- a/vllm/v1/structured_output/utils.py +++ b/vllm/v1/structured_output/utils.py @@ -12,7 +12,6 @@ import numpy as np import regex as re import torch from cachetools import LRUCache -from diskcache import Cache import vllm.envs as envs from vllm.logger import init_logger @@ -181,6 +180,8 @@ def get_outlines_cache(): cache_dir = get_outlines_cache_path() if envs.VLLM_V1_USE_OUTLINES_CACHE: + from diskcache import Cache + logger.warning( "Enabling outlines cache. This is an unbounded on-disk " "cache. It may consume a lot of disk space and should "