Running C++ code with embedded Python using the dune internal venv requires starting the program using run-in-dune-venv. It doesn't seem to possible to activate the venv within the C++ code.
run-in-dune-venv