vllm - ✅(Solved) Fix [Build]: spinloop.cpp fails with Py_LIMITED_API enabled: Py_buffer not declared [1 pull requests, 1 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#43035Fetched 2026-05-20 03:40:11
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Participants
Timeline (top)
cross-referenced ×1labeled ×1

Error Message

python vllm/collect_env.py Traceback (most recent call last): File "/lumos-vePFS/shenzhen/work/tools/vllm/vllm/collect_env.py", line 20, in <module> from vllm.envs import environment_variables ModuleNotFoundError: No module named 'vllm'

Fix Action

Fixed

PR fix notes

PR #43131: fix: avoid spinloop stable ABI on Python 3.10

Description (problem / solution / changelog)

## Summary

  • avoid requesting the Python 3.11 stable ABI for spinloop when the build interpreter is Python 3.10
  • keep the existing abi3 build path for Python 3.11+ where the buffer API is part of the stable ABI

Fixes #43035.

To verify

  • git diff --check upstream/main..HEAD

I could not run a full vLLM CMake build in this Windows clean clone; the change is limited to the CMake target selection that triggers the reported Python 3.10 header failure.

Changed files

  • CMakeLists.txt (modified, +7/-1)

Code Example

python vllm/collect_env.py 
Traceback (most recent call last):
  File "/lumos-vePFS/shenzhen/work/tools/vllm/vllm/collect_env.py", line 20, in <module>
    from vllm.envs import environment_variables
ModuleNotFoundError: No module named 'vllm'

---

FAILED: [code=1] CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o
  ccache /usr/bin/g++-12 -DPy_LIMITED_API=0x030b0000 -DTORCH_EXTENSION_NAME=spinloop -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_NVSHMEM -DUSE_RPC -DUSE_TENSORPIPE -Dspinloop_EXPORTS -I//vllm/cs
rc -isystem /root/Miniconda3_sz/envs/qwen3_1/include/python3.10 -isystem /root/Miniconda3_sz/envs/qwen3_1/lib/python3.10/site-packages/torch/include -isystem /root/Miniconda3_sz/envs/qwen3_1/lib/python3.10/site-packages/torch/include/tor
ch/csrc/api/include -isystem /usr/local/cuda/include -I/usr/local/cuda/include -O2 -g -DNDEBUG -std=gnu++20 -fPIC -mmwaitx -MD -MT CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o -MF CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o.d -o CMakeFile
s/spinloop.dir/csrc/spinloop.cpp.o -c //vllm/csrc/spinloop.cpp
  /lm/csrc/spinloop.cpp: In function �yObject* method_spinloop(PyObject*, PyObject*, PyObject*)  hork/tools/vllm/csrc/spinloop.cpp:58:3: error: �y_buffer�was not declared in this scope; did you mean �etbuffer�
     58 |   Py_buffer buffer;
        |   ^~~~~~~~~
        |   setbuffer
ork/tools/vllm/csrc/spinloop.cpp:70:37: error: �uffer�was not declared in this scope; did you mean �etbuffer�
     70 |                                    &buffer, &callback, &timeout)) {
        |                                     ^~~~~~
        |                                     setbuffer
  /ools/vllm/csrc/spinloop.cpp:76:23: error: �uffer�was not declared in this scope; did you mean �etbuffer�
RAW_BUFFERClick to expand / collapse

Your current environment

<details> <summary>The output of <code>python collect_env.py</code></summary>
python vllm/collect_env.py 
Traceback (most recent call last):
  File "/lumos-vePFS/shenzhen/work/tools/vllm/vllm/collect_env.py", line 20, in <module>
    from vllm.envs import environment_variables
ModuleNotFoundError: No module named 'vllm'
</details>

;atest

🐛 Describe the bug

FAILED: [code=1] CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o
  ccache /usr/bin/g++-12 -DPy_LIMITED_API=0x030b0000 -DTORCH_EXTENSION_NAME=spinloop -DUSE_C10D_GLOO -DUSE_C10D_NCCL -DUSE_DISTRIBUTED -DUSE_NVSHMEM -DUSE_RPC -DUSE_TENSORPIPE -Dspinloop_EXPORTS -I//vllm/cs
rc -isystem /root/Miniconda3_sz/envs/qwen3_1/include/python3.10 -isystem /root/Miniconda3_sz/envs/qwen3_1/lib/python3.10/site-packages/torch/include -isystem /root/Miniconda3_sz/envs/qwen3_1/lib/python3.10/site-packages/torch/include/tor
ch/csrc/api/include -isystem /usr/local/cuda/include -I/usr/local/cuda/include -O2 -g -DNDEBUG -std=gnu++20 -fPIC -mmwaitx -MD -MT CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o -MF CMakeFiles/spinloop.dir/csrc/spinloop.cpp.o.d -o CMakeFile
s/spinloop.dir/csrc/spinloop.cpp.o -c //vllm/csrc/spinloop.cpp
  /lm/csrc/spinloop.cpp: In function �yObject* method_spinloop(PyObject*, PyObject*, PyObject*)�
  hork/tools/vllm/csrc/spinloop.cpp:58:3: error: �y_buffer�was not declared in this scope; did you mean �etbuffer�
     58 |   Py_buffer buffer;
        |   ^~~~~~~~~
        |   setbuffer
ork/tools/vllm/csrc/spinloop.cpp:70:37: error: �uffer�was not declared in this scope; did you mean �etbuffer�
     70 |                                    &buffer, &callback, &timeout)) {
        |                                     ^~~~~~
        |                                     setbuffer
  /ools/vllm/csrc/spinloop.cpp:76:23: error: �uffer�was not declared in this scope; did you mean �etbuffer�

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.

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