Detecting Python.h when using an uv venv to setup a project
#1174
-
|
Sorry for the probably very noobish question but it's my first time using nanobind in a project together with CMake (and also am very rusty with CMake into VScode itself). I'm using VScode and developing in an uv-generated virtual environment to setup my project. nanobind is installed via
To tell VSCode where to find the headers I'm setting the {
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/.venv/Lib/site-packages/nanobind/include",
]
}
],
"version": 4
}This is a trimmed-down version but it just to show it correctly finds nanobind. {
"cmake.configureOnOpen": true,
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
}But that didn't help: VSCode still can't find |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Hey! Although it does not use vscode's CMake integration, there is an example project that shows how to set up CMake to build nanobind extensions with Otherwise, to get Python's include path, you can use |
Beta Was this translation helpful? Give feedback.
Hey! Although it does not use vscode's CMake integration, there is an example project that shows how to set up CMake to build nanobind extensions with
scikit-build-core: https://github.com/wjakob/nanobind_example (in short: it usesFindPython)Otherwise, to get Python's include path, you can use
python3 -c "import sysconfig; print(sysconfig.get_path('include'))", which should be static unless you change your venv's Python version frequently.