Environments (mtb.env)¶
Install the environments the methods run in. dry_run=True shows each
environment's state and download size. The environments are built for Linux
and, for the methods that Windows and
macOS list, for Windows and for macOS with Apple
silicon. On an Intel Mac only the dry run works.
| Name | Summary |
|---|---|
mtb.env.install |
Install the environments a set of methods needs, on Linux or Windows. |
Details
A run activates the installed environment folder, <envs_dir>/<env>,
directly, so no conda binary is needed. When no folder exists but conda
is installed, it uses conda run -n <env> instead.
MULTIBENCH_RUN_MODE=conda|prefix forces one mode, and prefix with no
environment folder raises OSError naming envs_dir. envs_dir
defaults to MULTIBENCH_ENVS_DIR when set. mtb.config
lists the other defaults.
In prefix mode on Linux the command runs under bash -c after setting
CONDA_PREFIX, putting <prefix>/bin first on PATH and sourcing
<prefix>/etc/conda/activate.d/*.sh. On Windows the environment's own
python.exe or Rscript.exe runs the script, with CONDA_PREFIX set
and the environment's folders first on PATH.
GPU or CPU? describes the CPU and GPU builds.
mtb.env.install
¶
install(
methods: list[str] | None = None,
*,
category: str | None = None,
dry_run: bool = False,
flavor: str = "auto",
build: bool = False,
)
Install the environments a set of methods needs, on Linux or Windows.
Each env is unpacked from its published archive, or built from its
lockfile where none is published (on Windows nothing is built: a method
without a published Windows archive is refused). Installed envs are
skipped. Then the method scripts are downloaded to
mtb.config.repo_path if they are missing.
| PARAMETERS | DESCRIPTION |
|---|---|
methods
|
Method ids to cover;
type
|
category
|
type
|
dry_run
|
type
|
flavor
|
type
|
build
|
type
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
One row per env, the env serving the most methods first: |
| RAISES | DESCRIPTION |
|---|---|
KeyError
|
Unknown method id. |
OSError
|
A real install on a host that is neither Linux nor Windows; on
Windows, a method without a Windows environment, |
RuntimeError
|
|
Examples