The Ark cmake build system provides the ability to generate Python virtual environments for specialized targets (and to use those virtual environments as dependencies for those targets).
The general format is:
add_python_venv( "my_venv_name" PACKAGES websocket-client torch pyyaml ARK_LIBRARIES "path/to/library/in/repo" RBUFS rbuf_target_name )
The virtual environment will be constructed for you as part of the build process and located
build/virtualenvs directory (for example,
It will automatically use
pip to install the websocket-client, torch, and pyyaml packages.
It will then copy the paths to the libraries that you gave directly into the virtual environment’s
site packages, such that they can be imported. It’s assumed that each path given to
is a path to a directory that contains, at a minimum, a
Finally, any rbuf target given will have the rbuf compiler invoked to generate native Python code,
and that will be installed into the virtual environment in a library that matches the target name. For
example, if you use
ark_image_messages as a target, it will create a Python module named
that you can import from.
A few other options that might be interesting:
BINDINGS- Copies a pybind11 module into the virtual environment
REPOS- Passes the repo to PIP, compiling it and installing it into your virtual environment
LINKS- Passes the list of links to PIP, as an alternate source for packages
You must manually add your virtual environment as a dependency to some other target for it to be
built automatically (or run
./make.sh my_venv_name to explicitly build that virtual environment).