[GH-ISSUE #15] error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} #10

Closed
opened 2026-10-29 21:07:51 +00:00 by bsakaguchi · 6 comments
Owner

Originally created by @gkm0120 on GitHub (Dec 4, 2024).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/15

Ubuntu 22.04、cmake==3.29.5、gcc==10.2.1、python3.11
After completing the compilation of cpprestsdk and etcd-cpp-apiv3, execute
cmake..
make -j$(nproc)
The following error occurs
Do I need to lower the python version, or lower the cmake version, or what should I do?

image
[ 17%] Built target rdma_transport
[ 21%] Built target tcp_transport
[ 25%] Built target transport
[ 42%] Built target transfer_engine
[ 50%] Built target transport_uint_test
[ 57%] Built target rdma_transport_test
[ 71%] Built target rdma_transport_test2
[ 71%] Built target tcp_transport_test
[ 78%] Built target transfer_metadata_test
[ 85%] Built target transfer_engine_bench
[ 92%] Built target memory_pool
[ 96%] Building CXX object mooncake-integration/CMakeFiles/mooncake_vllm_adaptor.dir/vllm/vllm_adaptor.cpp.o
In file included from /usr/include/pybind11/attr.h:13,
from /usr/include/pybind11/pybind11.h:45,
from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.h:17,
from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.cpp:15:
/usr/include/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’:
/usr/include/pybind11/cast.h:446:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’}
446 | " " + handle(frame->f_code->co_filename).caststd::string() +
| ^~
In file included from /opt/conda/include/python3.11/Python.h:42,
from /usr/include/pybind11/detail/common.h:124,
from /usr/include/pybind11/pytypes.h:12,
from /usr/include/pybind11/cast.h:13,
from /usr/include/pybind11/attr.h:13,
from /usr/include/pybind11/pybind11.h:45,
from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.h:17,
from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.cpp:15:
/opt/conda/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}

Originally created by @gkm0120 on GitHub (Dec 4, 2024). Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/15 Ubuntu 22.04、cmake==3.29.5、gcc==10.2.1、python3.11 After completing the compilation of cpprestsdk and etcd-cpp-apiv3, execute cmake.. make -j$(nproc) The following error occurs Do I need to lower the python version, or lower the cmake version, or what should I do? ![image](https://github.com/user-attachments/assets/6cc898f1-1bfb-40ff-8265-627d55268732) [ 17%] Built target rdma_transport [ 21%] Built target tcp_transport [ 25%] Built target transport [ 42%] Built target transfer_engine [ 50%] Built target transport_uint_test [ 57%] Built target rdma_transport_test [ 71%] Built target rdma_transport_test2 [ 71%] Built target tcp_transport_test [ 78%] Built target transfer_metadata_test [ 85%] Built target transfer_engine_bench [ 92%] Built target memory_pool [ 96%] Building CXX object mooncake-integration/CMakeFiles/mooncake_vllm_adaptor.dir/vllm/vllm_adaptor.cpp.o In file included from /usr/include/pybind11/attr.h:13, from /usr/include/pybind11/pybind11.h:45, from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.h:17, from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.cpp:15: /usr/include/pybind11/cast.h: In function ‘std::string pybind11::detail::error_string()’: /usr/include/pybind11/cast.h:446:36: error: invalid use of incomplete type ‘PyFrameObject’ {aka ‘struct _frame’} 446 | " " + handle(frame->f_code->co_filename).cast<std::string>() + | ^~ In file included from /opt/conda/include/python3.11/Python.h:42, from /usr/include/pybind11/detail/common.h:124, from /usr/include/pybind11/pytypes.h:12, from /usr/include/pybind11/cast.h:13, from /usr/include/pybind11/attr.h:13, from /usr/include/pybind11/pybind11.h:45, from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.h:17, from /models/Mooncake-main/mooncake-integration/vllm/vllm_adaptor.cpp:15: /opt/conda/include/python3.11/pytypedefs.h:22:16: note: forward declaration of ‘PyFrameObject’ {aka ‘struct _frame’}
Author
Owner

@alogfans commented on GitHub (Dec 4, 2024):

The pybind requires PyFrameObject, which was removed in python 3.11 (https://github.com/pybind/pybind11/discussions/4333). A workaround is to downgrade python version of (base) to 3.10, or build pybind by source code.

<!-- gh-comment-id:2515933995 --> @alogfans commented on GitHub (Dec 4, 2024): The pybind requires PyFrameObject, which was removed in python 3.11 (https://github.com/pybind/pybind11/discussions/4333). A workaround is to downgrade python version of (base) to 3.10, or build pybind by source code.
Author
Owner

@gkm0120 commented on GitHub (Dec 4, 2024):

Which source code should I compile 3.10 based on? Whether I can compile it through the source code corresponding to Mooncake. Is there any method or reference link?

<!-- gh-comment-id:2515996076 --> @gkm0120 commented on GitHub (Dec 4, 2024): Which source code should I compile 3.10 based on? Whether I can compile it through the source code corresponding to Mooncake. Is there any method or reference link?
Author
Owner

@alogfans commented on GitHub (Dec 5, 2024):

You can try use pip install to install correct version instead of apt install. See Pybind11 Install Guide

<!-- gh-comment-id:2518918312 --> @alogfans commented on GitHub (Dec 5, 2024): You can try use `pip install` to install correct version instead of `apt install`. See [Pybind11 Install Guide](https://pybind11.readthedocs.io/en/stable/installing.html)
Author
Owner

@wxsms commented on GitHub (Dec 5, 2024):

I fixed this by cloning pybind11 repo and:

cd pybind11
mkdir -p build
cd build
cmake ..
make -j && make install
<!-- gh-comment-id:2519400021 --> @wxsms commented on GitHub (Dec 5, 2024): I fixed this by cloning pybind11 repo and: ```bash cd pybind11 mkdir -p build cd build cmake .. make -j && make install ```
Author
Owner

@gkm0120 commented on GitHub (Dec 5, 2024):

Thanks, I completed the installation and compilation of the third-party library and mooncake by installing python 3.10.8, which avoided the above version problem. At the same time, I also cloned the pybind11 v2.13.6 repo and installed and compiled it, thus solving the previous python 3.11 issue.

<!-- gh-comment-id:2519734291 --> @gkm0120 commented on GitHub (Dec 5, 2024): Thanks, I completed the installation and compilation of the third-party library and mooncake by installing python 3.10.8, which avoided the above version problem. At the same time, I also cloned the pybind11 v2.13.6 repo and installed and compiled it, thus solving the previous python 3.11 issue.
Author
Owner

@pooyadavoodi commented on GitHub (Apr 14, 2025):

It would be great to add python 3.12 support

<!-- gh-comment-id:2800245241 --> @pooyadavoodi commented on GitHub (Apr 14, 2025): It would be great to add python 3.12 support
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/Mooncake#10
No description provided.