ImportError: cannot import name 'X' from 'vllm...' (GuidedDecodingParams, get_open_port, ChatCompletionRequest, ...): which vLLM releases have it
Most of these errors come from three vLLM releases. 0.12.0 (2025-12-03) removed GuidedDecodingParams (use StructuredOutputsParams, from 0.11.0) and split vllm.utils into submodules: get_open_port and get_ip are in vllm.utils.network_utils, FlexibleArgumentParser in vllm.utils.argparse_utils, get_tokenizer in vllm.tokenizers. 0.14.0 (2026-01-20) dropped the last deprecated alias, vllm.utils.get_open_port. 0.15.0 (2026-01-29) split vllm.entrypoints.openai.protocol by endpoint. The import is often not in your code but in TRL: TRL before 0.27.0 needs vLLM below 0.12.0, and trl vllm-serve before TRL 0.28.0 needs vLLM below 0.14.0. For any other name, in any module of vLLM, paste the error below.
Examples:
Runs in your browser on vllm.json (3,733 KB, about a fifth of that over the network); nothing you paste is sent anywhere. Covers 115 top-level names and 122,592 module-and-name pairs in 4,336 modules.
Which vLLM names moved, and where do I import them from now?
The imports other projects use most, and the release in which the old path stopped working. The lookup gives the same answer for every other name.
| Old import | Fails from | Import from now |
|---|---|---|
from vllm.utils import get_open_port | 0.14.0 (a deprecated alias in 0.12 and 0.13) | vllm.utils.network_utils |
from vllm.utils import get_ip | 0.12.0 | vllm.utils.network_utils |
from vllm.utils import FlexibleArgumentParser | 0.12.0 | vllm.utils.argparse_utils |
from vllm.utils import cdiv | 0.12.0 | vllm.utils.math_utils |
from vllm.transformers_utils.tokenizer import get_tokenizer | 0.12.0 | vllm.tokenizers |
from vllm.sampling_params import GuidedDecodingParams | 0.12.0 | vllm.sampling_params.StructuredOutputsParams (from 0.11.0) |
from vllm.entrypoints.openai.protocol import ChatCompletionRequest | 0.15.0 | vllm.entrypoints.openai.chat_completion.protocol |
from vllm.entrypoints.openai.protocol import CompletionRequest | 0.15.0 | vllm.entrypoints.openai.completion.protocol |
from vllm.entrypoints.openai.protocol import ErrorResponse | 0.15.0 | vllm.entrypoints.serve.engine.protocol (from 0.29.0; entrypoints.openai.engine.protocol in 0.15 to 0.28) |
from vllm.worker.worker import Worker | 0.11.0 | vllm.v1.worker.gpu_worker |
Names that did not move: from vllm import LLM, SamplingParams (every release), vllm.distributed.utils.StatelessProcessGroup (from 0.7.0), vllm.distributed.parallel_state.get_world_group (from 0.6.0) and vllm.distributed.device_communicators.pynccl.PyNcclCommunicator (from 0.5.0) are importable in 0.34.0.
Which TRL works with which vLLM?
The TRL release decides which vLLM names are imported. These ranges come from TRL's source at every release from 0.14.0 to 1.18.2.
| TRL | What it imports from vLLM | vLLM that imports |
|---|---|---|
| TRL 0.16.0 to 0.26.2 | GRPOTrainer, RLOOTrainer, OnlineDPOTrainer and trl vllm-serve import GuidedDecodingParams whenever vLLM is installed | below 0.12.0 |
| TRL 0.17.0 to 0.27.2 | trl vllm-serve imports get_open_port from vllm.utils | below 0.14.0 |
| TRL 0.27.0 and later | chooses GuidedDecodingParams or StructuredOutputsParams by vLLM version | any, for this name |
| TRL 0.28.0 and later | chooses vllm.utils or vllm.utils.network_utils for get_open_port | any, for this name |
TRL's own vllm extra pins a narrower range (for example vllm==0.10.2 in 0.24 and 0.25, <0.12.0 in 0.26, <0.34.0 in 1.18). A vLLM installed separately, or a newer one in a container image, ignores that pin; then the import fails with the errors on this page.
Which vLLM modules disappeared?
973 of the 4,336 modules that have existed are gone from 0.34.0; most are model and kernel files. The modules other code imported most, by release (deeper model, layer and backend files are left out of this table but are in the lookup):
| Release | Date (PyPI) | Modules gone | Modules |
|---|---|---|---|
| 0.11.0 | 2025-10-04 | 88 | vllm.adapter_commons, vllm.adapter_commons.layers, vllm.adapter_commons.models, vllm.adapter_commons.request, vllm.adapter_commons.utils, vllm.adapter_commons.worker_manager, vllm.attention.ops.nki_flash_attn, vllm.compilation.base_piecewise_backend, vllm.compilation.multi_output_match, vllm.core, vllm.core.block, vllm.core.block.block_table, vllm.core.block.common, vllm.core.block.cpu_gpu_block_allocator, vllm.core.block.interfaces, vllm.core.block.naive_block, vllm.core.block.prefix_caching_block, vllm.core.block.utils, vllm.core.block_manager, vllm.core.evictor, vllm.core.interfaces, vllm.core.placeholder_block_space_manager, vllm.core.scheduler, vllm.distributed.device_communicators.custom_all_reduce_utils, vllm.distributed.device_communicators.neuron_communicator, vllm.distributed.kv_transfer.kv_connector_agent, vllm.engine.async_timeout, vllm.engine.multiprocessing, vllm.engine.multiprocessing.client, vllm.engine.multiprocessing.engine, vllm.engine.output_processor, vllm.engine.output_processor.interfaces, vllm.engine.output_processor.multi_step, vllm.engine.output_processor.single_step, vllm.engine.output_processor.stop_checker, vllm.engine.output_processor.util, vllm.executor.mp_distributed_executor, vllm.executor.multiproc_worker_utils, vllm.inputs.registry, vllm.jsontree ... |
| 0.12.0 | 2025-12-03 | 29 | vllm.attention.ops.rocm_aiter_mla, vllm.attention.ops.rocm_aiter_paged_attn, vllm.attention.ops.triton_flash_attention, vllm.compilation.cuda_piecewise_backend, vllm.engine.metrics, vllm.engine.metrics_types, vllm.entrypoints.openai.logits_processors, vllm.entrypoints.openai.serving_classification, vllm.entrypoints.openai.serving_embedding, vllm.entrypoints.openai.serving_pooling, vllm.entrypoints.openai.serving_score, vllm.executor, vllm.executor.executor_base, vllm.executor.msgspec_utils, vllm.executor.ray_distributed_executor, vllm.executor.ray_utils, vllm.executor.uniproc_executor, vllm.lora.layers.qkv_x_parallel_linear, vllm.model_executor.layers.shared_fused_moe, vllm.test_utils, vllm.transformers_utils.configs.deepseek_v3, vllm.transformers_utils.configs.nemotron_vl, vllm.transformers_utils.detokenizer_utils, vllm.transformers_utils.tokenizers, vllm.transformers_utils.tokenizers.mistral, vllm.v1.executor.utils, vllm.v1.worker.ubatch_splitting, vllm.worker, vllm.worker.worker_base |
| 0.14.0 | 2026-01-20 | 30 | vllm.attention.layers, vllm.attention.layers.chunked_local_attention, vllm.attention.layers.cross_attention, vllm.attention.layers.encoder_only_attention, vllm.attention.layers.mm_encoder_attention, vllm.attention.ops, vllm.attention.ops.chunked_prefill_paged_decode, vllm.attention.ops.common, vllm.attention.ops.flashmla, vllm.attention.ops.merge_attn_states, vllm.attention.ops.paged_attn, vllm.attention.ops.pallas_kv_cache_update, vllm.attention.ops.prefix_prefill, vllm.attention.ops.rocm_aiter_mla_sparse, vllm.attention.ops.triton_decode_attention, vllm.attention.ops.triton_merge_attn_states, vllm.attention.ops.triton_reshape_and_cache_flash, vllm.attention.ops.triton_unified_attention, vllm.attention.ops.vit_attn_wrappers, vllm.attention.selector, vllm.attention.utils.fa_utils, vllm.distributed.device_communicators.tpu_communicator, vllm.distributed.tpu_distributed_utils, vllm.entrypoints.openai.tool_parsers, vllm.lora.ops.xla_ops, vllm.lora.punica_wrapper.punica_tpu, vllm.model_executor.model_loader.tpu, vllm.transformers_utils.tokenizer_base, vllm.v1.engine.processor, vllm.v1.worker.tpu_model_runner |
| 0.15.0 | 2026-01-29 | 18 | vllm.entrypoints.anthropic.serving_messages, vllm.entrypoints.context, vllm.entrypoints.openai.protocol, vllm.entrypoints.openai.serving_chat, vllm.entrypoints.openai.serving_chat_stream_harmony, vllm.entrypoints.openai.serving_completion, vllm.entrypoints.openai.serving_engine, vllm.entrypoints.openai.serving_models, vllm.entrypoints.openai.serving_responses, vllm.entrypoints.openai.serving_transcription, vllm.entrypoints.responses_utils, vllm.entrypoints.score_utils, vllm.entrypoints.tool, vllm.entrypoints.tool_server, vllm.multimodal.base, vllm.multimodal.profiling, vllm.v1.sample.tpu, vllm.v1.worker.tpu_worker |
| 0.22.0 | 2026-05-29 | 8 | vllm.beam_search, vllm.entrypoints.openai.realtime, vllm.entrypoints.openai.speech_to_text, vllm.model_executor.layers.deepseek_compressor, vllm.model_executor.layers.deepseek_v4_attention, vllm.model_executor.layers.kda, vllm.transformers_utils.tokenizer, vllm.v1.kv_offload.reuse_manager |
How do I read the error?
- The file in the traceback tells you whose import it is.
trl/trainer/grpo_trainer.pyortrl/scripts/vllm_serve.pymeans TRL; fix it with the TRL table above, not in your code. - A DeprecationWarning like "vllm.utils.get_open_port is deprecated and will be removed in a future version" (vLLM 0.12 and 0.13) is the last release before the import fails.
- Patch releases: vLLM 0.11.1 and 0.11.2 already shipped some of the 0.12.0 submodules, such as
vllm.utils.network_utils. This page reads the first release of each minor version, so it says "from 0.12.0".
How was this read, and how was it checked?
From the source of each release tag, with Python's ast module; no release was installed or imported. A module's names are everything it binds at module level, what from .x import * brings in, and the names a module-level __getattr__ serves from a table of strings (the lazy top level of vllm, the deprecated aliases of vllm.utils in 0.12 and 0.13, the lazy config and processor classes of vllm.transformers_utils). Code under if TYPE_CHECKING: is skipped. Dates come from PyPI. The TRL column was read from TRL's release tags the same way.
Checks: (1) each of the 115 top-level names is found as plain text in vllm/__init__.py in every release of its range (2,512 name-and-release pairs) and not on either side (30 edges). (2) A regular expression finds 206,105 definitions in 22,937 file versions; all are among the names read. (3) Against a different source, the wheels on PyPI (read by HTTP range requests), 18 release checks agree:
| Name or module | Release | Wheel and data |
|---|---|---|
vllm.sampling_params.GuidedDecodingParams | 0.11.2 | has it |
vllm.sampling_params.GuidedDecodingParams | 0.12.0 | does not |
vllm.sampling_params.StructuredOutputsParams | 0.11.0 | has it |
vllm.sampling_params.StructuredOutputsParams | 0.10.2 | does not |
vllm.utils.get_open_port | 0.13.0 | has it |
vllm.utils.get_open_port | 0.14.0 | does not |
vllm.utils.network_utils.get_open_port | 0.12.0 | has it |
vllm.utils.network_utils.get_open_port | 0.11.0 | does not |
vllm.utils.FlexibleArgumentParser | 0.11.0 | has it |
vllm.utils.FlexibleArgumentParser | 0.12.0 | does not |
vllm.entrypoints.openai.protocol | 0.14.1 | has it |
vllm.entrypoints.openai.protocol | 0.15.0 | does not |
vllm.entrypoints.openai.chat_completion.protocol.ChatCompletionRequest | 0.15.0 | has it |
vllm.entrypoints.openai.chat_completion.protocol.ChatCompletionRequest | 0.14.1 | does not |
vllm.worker.worker | 0.10.2 | has it |
vllm.worker.worker | 0.11.0 | does not |
vllm.model_executor.guided_decoding | 0.10.0 | has it |
vllm.model_executor.guided_decoding | 0.11.0 | does not |
Limits
- Nothing was installed or run. "Has it" means the import statement resolves in the source; an import can still fail at run time for another reason (a missing CUDA library, a compiled extension built for a different PyTorch).
- Only the first release of each minor version was read (and the newest). A change in a patch release is attributed to the next minor.
- Names a module serves through a
__getattr__that computes them, rather than looking them up in a table, are not counted.
Questions
How do I fix "cannot import name 'GuidedDecodingParams' from 'vllm.sampling_params'"?
vLLM 0.12.0 (2025-12-03) removed GuidedDecodingParams; 0.11.2 is the last release with it. Its replacement, StructuredOutputsParams, exists from 0.11.0. If the import is in TRL (GRPOTrainer, RLOOTrainer, OnlineDPOTrainer or trl vllm-serve), upgrade TRL to 0.27.0 or later, which picks the class by vLLM version, or keep vLLM below 0.12.0.
How do I fix "cannot import name 'get_open_port' from 'vllm.utils'"?
Import it from vllm.utils.network_utils (from 0.12.0). vLLM 0.12 and 0.13 still served the old import with a DeprecationWarning; 0.14.0 (2026-01-20) removed it. trl vllm-serve before TRL 0.28.0 uses the old import, so upgrade TRL or keep vLLM below 0.14.0.
Where did vllm.entrypoints.openai.protocol go?
vLLM 0.15.0 (2026-01-29) split it by endpoint: ChatCompletionRequest is in vllm.entrypoints.openai.chat_completion.protocol, CompletionRequest in vllm.entrypoints.openai.completion.protocol, and ErrorResponse in vllm.entrypoints.serve.engine.protocol from 0.29.0. 0.14.1 is the last release with the old module.
Why do so many vllm.utils imports fail after upgrading to vLLM 0.12?
0.12.0 split vllm.utils into submodules (network_utils, argparse_utils, math_utils, torch_utils, mem_utils and others) and moved get_tokenizer to vllm.tokenizers. Only three names kept a deprecated alias. The lookup shows the new module for each name.
Does this page cover the model and layer modules too?
Yes: every module of vllm from 0.1.0 to 0.34.0, 122,592 module-and-name pairs in 4,336 modules, read at the first release of each minor version.
Sources
- vllm-project/vllm, release tags v0.1.0 to v0.34.0: every
.pyfile under vllm/; deprecated aliases in vllm/utils/__init__.py at v0.13.0; release dates from PyPI. - huggingface/trl, release tags v0.14.0 to v1.18.2: trainer/grpo_trainer.py, scripts/vllm_serve.py and the
vllmextra in setup.cfg and pyproject.toml. - Report: TRL issue 4617 (GuidedDecodingParams from vllm.sampling_params, TRL 0.25.0).
The same data as JSON: vllm.json, licensed CC BY 4.0.
Related: vllm serve "unrecognized arguments" · which PyTorch and CUDA each vLLM release needs · "cannot import name ... from 'trl'" · "... from 'transformers'".