ensureconda
Installation
Python-based
ensureconda is distributed on PyPI as a universal wheel and is available on Linux, macOS and Windows and supports Python 3.8+ and PyPy.
$ pip install ensureconda
It's also available from conda-forge:
$ conda install -c conda-forge ensureconda
Go based
ensureconda is also available as a stand-alone Go binary; the Linux builds are
statically linked. It finds or installs an executable and prints its path.
The conda target checks CONDA_EXE first.
These can be downloaded from releases
Alternatively, if you have Go installed, you can install it from GitHub using
$ go install github.com/conda-incubator/ensureconda@latest
$ ensureconda --help
Usage
Ensureconda is a cli tool that will
- Find a preexisting conda/mamba executable
- Install one if nothing was found and installation is allowed.
- Return the path of the executable found/installed on stdout
ensureconda --help
Usage: ensureconda [OPTIONS]
Ensures that a conda/mamba is installed.
Options:
--mamba / --no-mamba search for mamba
--micromamba / --no-micromamba search for micromamba, install if not
present
--conda / --no-conda search for conda
--conda-exe / --no-conda-exe search for conda.exe / conda-standalone,
install if not present
--no-install don't install conda/mamba if no version can
be discovered
--force-install skip existing executables and download a
fresh copy
--min-conda-version VERSIONNUMBER
minimum version of conda to accept (defaults
to 4.8.2)
--min-mamba-version VERSIONNUMBER
minimum version of mamba/micromamba to
accept (defaults to 0.7.3)
--json print the executable's path, flavor and
version as JSON
-v, --verbosity INTEGER RANGE 0: warnings; 1: decisions; 2-3: debug
details [default: 1; 0<=x<=3]
--help Show this message and exit.
Use --force-install to download a fresh executable into ensureconda's data
directory, even if a compatible copy exists there or on PATH. To refresh
conda-standalone instead of micromamba, use
ensureconda --force-install --no-micromamba.
With --json, ensureconda prints the executable's path, flavor and version
instead of just its path:
$ ensureconda --json
{"path": "/home/user/.local/share/ensure-conda/micromamba", "flavor": "micromamba", "version": "2.9.0"}
Python API
import ensureconda
result = ensureconda.ensure()
if result is not None:
print(result.path, result.flavor, result.version)
ensureconda.ensure(["micromamba>=2,<3", "conda>=24"])
ensureconda.ensure(["conda", "micromamba"], install="never")
ensureconda.identify("/opt/conda/bin/conda") # Describe a given executable
# The old API still returns only a path, or None.
ensureconda.ensureconda(micromamba=False, min_conda_version=None)
ensure() tries an ordered sequence of targets, by default mamba,
micromamba, conda and conda_standalone. A target can add version
constraints in Python packaging's version-specifier syntax, such as >=2,<3 or
==2.9.*. The first compatible executable can be later on PATH than the
one your shell would run. The result's version is None if the executable
doesn't report one, and such an executable can't satisfy a constraint. Later
releases may add fields to the result or keys to ensureconda --json.
The Python API and CLI check CONDA_EXE for conda or conda-standalone.
For mamba or micromamba, they check MAMBA_EXE first and then CONDA_EXE.
If no launcher matches the requested tool and version, they search the data
directory and PATH.
Version constraints skip prereleases unless you request one, as in
micromamba>=2.0rc1. A plain micromamba target can use an installed
prerelease and downloads a stable release if needed.
The install argument selects when installation is attempted. Only
micromamba and conda_standalone can be installed.
"fallback", the default: use any installed target before installing one. With["micromamba", "conda"], an installed conda is used if micromamba is absent."per-target": search for and install each target in turn, so["micromamba", "conda"]installs micromamba even if conda is present."never": only search for installed executables."force": skip installed and cached executables and download fresh copies.
When installing, ensureconda downloads the newest published release that
satisfies the target, so ensure(["micromamba<2"]) can install micromamba 1.x.
A download that fails to run or doesn't satisfy the target never replaces the
cached executable. For unconstrained targets, probe_version=False skips
checking that installed executables run and returns version=None.
Both installers can download micromamba from conda-forge when micro.mamba.pm
is unavailable.
ensureconda(), the old API, keeps its options, its path-or-None result and
its original target order.
Diagnostics
Both command lines write diagnostics to stderr, keeping stdout for the
executable path or --json result; --verbosity selects how much they say.
The Python API logs its decisions under the ensureconda logger.
Cache location
By default, ensureconda stores downloaded executables in:
- Linux:
~/.local/share/ensure-conda(or$XDG_DATA_HOME/ensure-condaif set) - macOS:
~/Library/Application Support/ensure-conda - Windows:
%LOCALAPPDATA%\ensure-conda\ensure-conda
To use a different directory, set ENSURECONDA_DATA_DIR to its path.
This applies to both Python and Go.
Configuring conda-standalone channel
When ensureconda downloads the conda-standalone executable, you can select the
channel via the environment variable ENSURECONDA_CONDA_STANDALONE_CHANNEL.
It defaults to conda-forge, and you can set it to anaconda if you prefer:
export ENSURECONDA_CONDA_STANDALONE_CHANNEL=anaconda
ensureconda --conda-exe
The corresponding package page used is:
https://anaconda.org/$ENSURECONDA_CONDA_STANDALONE_CHANNEL/conda-standalone
License
ensureconda is distributed under the terms of the MIT License.
Metadata
Release files for ensureconda 1.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ensureconda-1.8.0.tar.gz | 26.2 kB | Without provenance | Details for ensureconda-1.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ensureconda-1.8.0-py3-none-any.whl | Python 3 | none | any | Details for ensureconda-1.8.0-py3-none-any.whl |
Total release size: 56.3 kB
Release files / ensureconda-1.8.0.tar.gz
| Download URL | ensureconda-1.8.0.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ccb510f65d3618a9e5a8143b34306f687d73e86383e130b6fc1ba243bce6438
|
|
BLAKE2b-256 checksum How to use checksums |
1273636b6169547a710ba12bc01df98644a9ab201bf1e371ce3af99774ab04b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / ensureconda-1.8.0-py3-none-any.whl
| Download URL | ensureconda-1.8.0-py3-none-any.whl |
|---|---|
| Size | 30.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a461df460e2bc83ca86224b093b4e86e906abe94cce5de8edf96625c8221dce
|
|
BLAKE2b-256 checksum How to use checksums |
53cb2232f6218a985026117e10b8d0b5ad2bfd584b3d5e5569748c54736efdc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for ensureconda 1.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.