ensureconda

raw JSON →
1.6.0 verified Fri May 01 auth: no python

Lightweight bootstrapper for a conda executable. Automatically downloads and installs conda or mamba (including conda-standalone) if not already present. Current version 1.6.0, requires Python >=3.8. Active maintenance with occasional releases.

pip install ensureconda
error AttributeError: module 'ensureconda' has no attribute 'ensureconda'
cause Importing the package incorrectly or using an old version that uses a different API.
fix
Use import ensureconda and call ensureconda.ensureconda() or upgrade to >=1.4.0.
error ConnectionError: Unable to download conda-standalone from ...
cause Network issues or the download URL changed (especially after v1.6.0 default channel switch).
fix
Set ENSURECONDA_CONDA_STANDALONE_CHANNEL to anaconda or conda-forge, or manually install conda.
error ValueError: Unsupported platform
cause Running on a platform for which conda-standalone is not available (e.g., 32-bit).
fix
Install conda/mamba via other means, or use a compatible platform.
breaking In v1.6.0, conda-standalone is downloaded from conda-forge instead of the Anaconda channel. To revert to Anaconda channel, set environment variable ENSURECONDA_CONDA_STANDALONE_CHANNEL=anaconda or downgrade to v1.5.
fix export ENSURECONDA_CONDA_STANDALONE_CHANNEL=anaconda before calling ensureconda.
gotcha ensureconda may download large binaries (conda-standalone). Ensure network access and sufficient disk space, especially in CI environments.
fix Pre-install conda/mamba in the environment or use a persistent cache.
deprecated The conda-standalone from the Anaconda channel is no longer the default since v1.6.0. The new default is conda-forge, which may have different behavior.
fix Check compatibility with conda-forge's conda-standalone or override channel.

Basic usage: ensureconda() finds or installs conda. Pass mamba=True for mamba.

import ensureconda

# Returns path to conda executable (downloads if needed)
conda_path = ensureconda.ensureconda()
print(conda_path)

# Or use a specific package manager
mamba_path = ensureconda.ensureconda(mamba=True)
print(mamba_path)