Skip to main content

condacolab

Downloads Downloads Downloads

Install Conda and friends on Google Colab, easily.

CondaColab

Usage

TLDR: Check the example notebook here!

On your Colab notebook, run the following code as the first executable cell:

!pip install -q condacolab
import condacolab
condacolab.install()

After the kernel restart, you can optionally add a new cell to check that everything is in place:

import condacolab
condacolab.check()

It is important that you perform the installation first thing in the notebook because it will require a kernel restart, thus resetting the variables set up to that point.

The default condacolab.install() provides Mambaforge, but there are other conda distributions to choose from:

  • install_miniconda(): This will install the Miniconda distribution, using a version built for Python 3.11. Unlike Anaconda, this distribution only contains python and conda.
  • install_miniforge(): Like Miniconda, but built off conda-forge packages. The Miniforge distribution is officially provided by conda-forge.

For advanced users, install_from_url() is also available. It expects a URL pointing to a constructor-like installer, so you can prebuild a Python 3.11 distribution that fulfills your own needs.

If you want to build your own constructor-based installer, check the FAQ below!

Once the installation is done, you can use conda and/or mamba to install the needed packages:

!conda install openmm

# or, faster:
!mamba install openmm

If you have a environment file (e.g. environment.yml), you can use it like this:

!conda env update -n base -f environment.yml

# or, faster:
!mamba env update -n base -f environment.yml

Shortcomings

  • The Python kernel needs to be restarted for changes to be applied. This happens automatically. If you are wondering why you are seeing a message saying "Your session crashed for an unknown reason", this is why. You can safely ignore this message!
  • You can only use the base environment, so do not try to create more environments with conda create. If you have an environment file, use conda env update -n base -f <your-file.yml>.

FAQ

How does it work?

Google Colab runs on Python 3.11. We install the Miniconda distribution on top of the existing one at /usr/local, add a few configuration files so we stay with Python 3.11 and the newly installed packages are available. Finally, we wrap the Python executable to redirect and inject some environment variables needed to load the new libraries. Since we need to re-read LD_LIBRARY_PATH, a kernel restart is needed.

How can I cache my installation? I don't want to wait every time I start Colab.

The recommended approach is to build your own constructor-based installer. We have provided an example in constructor-example/construct.yaml.

You can generate a constructor installer on Colab too! Follow this tutorial.

Locally, follow these steps:

  1. In your local computer:
conda create -n constructor -c conda-forge constructor
conda activate constructor
mkdir my-installer
cd my-installer
curl -sLO https://raw.githubusercontent.com/jaimergp/condacolab/main/constructor-example/construct.yaml
curl -sLO https://raw.githubusercontent.com/jaimergp/condacolab/main/constructor-example/pip-dependencies.sh
  1. Add your conda packages to construct.yaml in the specs section. Read the comments to respect the constrains already present! You can also adapt the metadata to your liking.
  2. If you do need to install pip requirements, uncomment the post_install line and edit pip-dependencies.sh.
  3. Run constructor --platform linux-64 .
  4. Upload the resulting .sh to an online location with a permanent URL. GitHub Releases is great for this!
  5. In Colab, run:
!pip install -q condacolab
import condacolab
condacolab.install_from_url(URL_TO_YOUR_CUSTOM_CONSTRUCTOR_INSTALLER)

Can I install R packages?

Yes, as long as you make sure you also install rpy2 to overwrite Colab's installation. See issue #26 for more details.

Metadata

Release files for condacolab 0.1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for condacolab 0.1.13
File Size Uploaded Provenance
condacolab-0.1.13.tar.gz 37.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for condacolab 0.1.13
File Interpreter ABI Platform
condacolab-0.1.13-py3-none-any.whl Python 3 none any Details

Total release size: 45.2 kB

Release files / condacolab-0.1.13.tar.gz

Download URL condacolab-0.1.13.tar.gz
Size 37.4 kB
Tags Source
SHA-256 checksum
How to use checksums
eb1722c1233a33320468ee4372b9b86d4ff2e140697fac7d30203ebc8468dcd4
BLAKE2b-256 checksum
How to use checksums
ae0c90475f005d0d879347a24a385992fb0a6bf9ff3cf592e4d25964cd02d60d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / condacolab-0.1.13-py3-none-any.whl

Download URL condacolab-0.1.13-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
acf9d0f3d8f7fa2c1f71a5acd460cc900e186ab6540e70f7b26355605aa262c4
BLAKE2b-256 checksum
How to use checksums
eda0f1a9f98059335924174784d20d7798db401b0cb058bfc08acd56da76a712
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Security for condacolab 0.1.13

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for condacolab-0.1.13.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page