This project uses pybind11 to build Python .pyd extension modules on Windows. Because Windows installs multiple Python versions, and pybind11 currently only supports up to Python 3.12, you must follow these steps exactly.
Check installed Python versions: py -0
If Python 3.12 is missing: winget install Python.Python.3.12
Install pybind11 for Python 3.12: py -3.12 -m pip install pybind11
IMPORTANT: You must build AND run with the same Python interpreter version (3.12).
Open the “Developer Command Prompt for Visual Studio”.
From the project root:
mkdir build_python_win cd build_python_win
Run CMake using the exact path to python.exe for Python 3.12:
cmake -G "Visual Studio 17 2022" -A x64 -DBASISU_BUILD_PYTHON=ON -DBASISU_BUILD_WASM=OFF -DPYTHON_EXECUTABLE="C:\Users\<YOU>\AppData\Local\Programs\Python\Python312\python.exe" ..
Build:
cmake --build . --config Release
Output files will be created in:
python/basisu_py/basisu_python.pyd python/basisu_py/basisu_transcoder_python.pyd
Always run using Python 3.12:
py -3.12
Inside Python:
import basisu_py
print("Modules loaded OK.")
While in the “python” directory:
py -m tests.test_backend_loading
Install wasmtime:
py -3.12 -m pip install wasmtime
Ensure these files exist:
python/basisu_py/wasm/*.wasm
“pybind11 not found” -> Installed into wrong Python version. Use: py -3.12 -m pip install pybind11
“Python config failure” -> You are using Python 3.13 or 3.14. Must use Python 3.12.
Modules not loading -> You must run them with the same interpreter used to build them: py -3.12