vllm - 💡(How to fix) Fix [Bug]: ImportError: cannot import name 'GenerationConfig' from 'transformers' [2 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
vllm-project/vllm#40463Fetched 2026-04-22 07:45:27
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
0
Timeline (top)
commented ×2closed ×1labeled ×1

Error Message

vllm-qwen35 | Traceback (most recent call last): vllm-qwen35 | File "/usr/local/bin/vllm", line 10, in <module> vllm-qwen35 | sys.exit(main()) vllm-qwen35 | ^^^^^^ vllm-qwen35 | File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/cli/main.py", line 87, in main vllm-qwen35 | import vllm.entrypoints.cli.benchmark.main vllm-qwen35 | File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/cli/benchmark/main.py", line 10, in <module> vllm-qwen35 | from vllm.entrypoints.utils import VLLM_SUBCMD_PARSER_EPILOG vllm-qwen35 | File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/utils.py", line 19, in <module> vllm-qwen35 | from vllm.engine.arg_utils import EngineArgs vllm-qwen35 | File "/usr/local/lib/python3.12/dist-packages/vllm/engine/arg_utils.py", line 35, in <module> vllm-qwen35 | from vllm.config import ( vllm-qwen35 | File "/usr/local/lib/python3.12/dist-packages/vllm/config/init.py", line 20, in <module> vllm-qwen35 | from vllm.config.model import ( vllm-qwen35 | File "/usr/local/lib/python3.12/dist-packages/vllm/config/model.py", line 30, in <module> vllm-qwen35 | from vllm.transformers_utils.config import ( vllm-qwen35 | File "/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/config.py", line 18, in <module> vllm-qwen35 | from transformers import GenerationConfig, PretrainedConfig vllm-qwen35 | ImportError: cannot import name 'GenerationConfig' from 'transformers' (/usr/local/lib/python3.12/dist-packages/transformers/init.py) vllm-qwen35 exited with code 1

Code Example

NA

---

vllm-qwen35  | Traceback (most recent call last):
vllm-qwen35  |   File "/usr/local/bin/vllm", line 10, in <module>
vllm-qwen35  |     sys.exit(main())
vllm-qwen35  |              ^^^^^^
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/cli/main.py", line 87, in main
vllm-qwen35  |     import vllm.entrypoints.cli.benchmark.main
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/cli/benchmark/main.py", line 10, in <module>
vllm-qwen35  |     from vllm.entrypoints.utils import VLLM_SUBCMD_PARSER_EPILOG
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/utils.py", line 19, in <module>
vllm-qwen35  |     from vllm.engine.arg_utils import EngineArgs
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/arg_utils.py", line 35, in <module>
vllm-qwen35  |     from vllm.config import (
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/config/__init__.py", line 20, in <module>
vllm-qwen35  |     from vllm.config.model import (
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/config/model.py", line 30, in <module>
vllm-qwen35  |     from vllm.transformers_utils.config import (
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/config.py", line 18, in <module>
vllm-qwen35  |     from transformers import GenerationConfig, PretrainedConfig
vllm-qwen35  | ImportError: cannot import name 'GenerationConfig' from 'transformers' (/usr/local/lib/python3.12/dist-packages/transformers/__init__.py)
vllm-qwen35 exited with code 1
RAW_BUFFERClick to expand / collapse

Your current environment

<details> <summary>The output of <code>python collect_env.py</code></summary>
NA
</details>

🐛 Describe the bug

I am using the docker container vllm/vllm-openai:cu130-nightly

vllm-qwen35  | Traceback (most recent call last):
vllm-qwen35  |   File "/usr/local/bin/vllm", line 10, in <module>
vllm-qwen35  |     sys.exit(main())
vllm-qwen35  |              ^^^^^^
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/cli/main.py", line 87, in main
vllm-qwen35  |     import vllm.entrypoints.cli.benchmark.main
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/cli/benchmark/main.py", line 10, in <module>
vllm-qwen35  |     from vllm.entrypoints.utils import VLLM_SUBCMD_PARSER_EPILOG
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/entrypoints/utils.py", line 19, in <module>
vllm-qwen35  |     from vllm.engine.arg_utils import EngineArgs
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/engine/arg_utils.py", line 35, in <module>
vllm-qwen35  |     from vllm.config import (
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/config/__init__.py", line 20, in <module>
vllm-qwen35  |     from vllm.config.model import (
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/config/model.py", line 30, in <module>
vllm-qwen35  |     from vllm.transformers_utils.config import (
vllm-qwen35  |   File "/usr/local/lib/python3.12/dist-packages/vllm/transformers_utils/config.py", line 18, in <module>
vllm-qwen35  |     from transformers import GenerationConfig, PretrainedConfig
vllm-qwen35  | ImportError: cannot import name 'GenerationConfig' from 'transformers' (/usr/local/lib/python3.12/dist-packages/transformers/__init__.py)
vllm-qwen35 exited with code 1

It still works with container: vllm/vllm-openai:cu130-nightly-55e1a8e1035bddb0b5b63f9ddecc8b4e16fc3ef6

After this version is seems to be broken.

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

extent analysis

TL;DR

The issue is likely due to an incompatible version of the transformers library, which is missing the GenerationConfig class.

Guidance

  • The error message indicates that the GenerationConfig class is not found in the transformers library, suggesting a version mismatch.
  • The fact that it works with an older version of the container (vllm/vllm-openai:cu130-nightly-55e1a8e1035bddb0b5b63f9ddecc8b4e16fc3ef6) implies that the issue is related to a change in the transformers library.
  • To mitigate the issue, you can try downgrading the transformers library to a version that is compatible with the vllm library.
  • You can verify the version of the transformers library being used by checking the container's dependencies or by running a command like pip show transformers inside the container.

Notes

The exact version of the transformers library that is compatible with the vllm library is not specified, so some trial and error may be required to find the correct version.

Recommendation

Apply workaround: Downgrade the transformers library to a version that is known to work with the vllm library, such as the version used in the working container (vllm/vllm-openai:cu130-nightly-55e1a8e1035bddb0b5b63f9ddecc8b4e16fc3ef6).

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

vllm - 💡(How to fix) Fix [Bug]: ImportError: cannot import name 'GenerationConfig' from 'transformers' [2 comments, 3 participants]