Skip to content

Repository files navigation

condacolab

Install conda packages on Google Colab, easily.

CondaColab

⚠️ Note: This README refers to the development version of condacolab. If you are looking for the stable version, please check the 0.1.x branch.

Basic usage

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

!pip install -q "https://github.com/conda-incubator/condacolab/archive/main.zip"
import condacolab
condacolab.install()

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.

This will set up a bare environment with only the essentials to run the Python kernel. If you need more packages, use the dependencies and/or pypi_dependencies arguments. You can also change the default Python version.

# Use Python 3.14
condacolab.install(python_version="3.14")
# Install numpy>=2 and scipy
condacolab.install(dependencies={"numpy": ">=2", "scipy": "*"})

FAQ

Do you have any examples to get started?

Yes, check this example notebook for more information.

How can I use my environment.yml with condacolab?

condacolab or Pixi do no support them directly, but here's a one-liner workaround you can run once condacolab.install() has run:

!pixi exec conda install --file environment.yml --prefix "$CONDA_PREFIX" --yes

The trick is to know that the restarted kernel runs on an activated conda environment, so you can use $CONDA_PREFIX to refer to it. Do note that any other pixi operations on the environment might undo that operation, so make sure to run this workaround as the last step of the setup.

About

Install conda packages on Google Colab, easily

Resources

Code of conduct

Contributing

Stars

364 stars

Watchers

5 watching

Forks

Releases

Packages

Used by

Contributors

Languages