how-to-install.md 5.1 KB


description: Installing Avalanche has Never Been so Simple

How to Install

Avalanche has been designed for extreme portability and usability. Indeed, it can be run on every OS and native python environment. 💻🍎🐧

In order to install Avalanche we have three main options:

  1. Installing it with Pip
  2. Installing it with Anaconda
  3. Developer Mode Install (for contributing to Avalanche!)

🔂 Avalanche Dependencies

The Avalanche dependencies are the following:

python>=3.6,<=3.9.2, typing-extensions, psutil, torch, torchvision, tensorboard, scikit-learn, matplotlib, numpy, pytorchcv, quadprog, tqdm, gdown, pycocotools.

{% hint style="info" %} Avalanche may work on lower Python versions as well but we don't officially support it, nor recommend it. {% endhint %}

At the moment, we cannot provide a swift installation experience as some of the dependencies cannot be installed automatically. However, in the sections below we detail how you can install Avalanche in a matter of minutes on any platform!

📦 Installing Avalanche with Pip

Within an Anaconda environment or not you can install Avalanche also with Pip with the following steps:

  1. Install the package with pip.
  2. Install Pytorch + TorchVision (follow the instructions on the website to use pip)

Step 1. can be done with the following line of code:

pip install git+https://github.com/ContinualAI/avalanche.git

That's it. now we have Avalanche up and running and we can start using it!

🐍 Install Avalanche with Anaconda

This is the safest option since it allows you to build an isolated environment for your Avalanche experiments. This means that you'll be able to pin particular versions of your dependencies that may differ from the ones you want to maintain in the rest of your system. This will in turn increase reproducibility of any experiment you may produce.

Assuming you have Anaconda (or Miniconda) installed on your system, you can follow these simple steps:

  1. Install the avalanche-env environment and activate it.
  2. Install Pytorch + TorchVision (follow the instructions on the website to use conda)
  3. Update the Conda Environment

These steps can be accomplished with the following lines of code:

# choose your python version
python="3.8"

# Step 1
git clone https://github.com/ContinualAI/avalanche.git
cd avalanche
conda create -n avalanche-env python=$python -c conda-forge
conda activate avalanche-env

# Step 2
# Istall Pytorch with Conda (instructions here: https://pytorch.org/)

# Step 3
conda env update --file environment.yml

{% hint style="info" %} On Linux, alternatively, you can simply run the install_environment.sh in the Avalanche home directory. The script takes 2 arguments: --python and --cuda_version. Check --help for details. {% endhint %}

You can test your installation by running the examples/test_install.py script. Make sure to include avalanche into your $PYTHONPATH if you are running examples with the command line interface.

💻 Developer Mode Install

If you want to expand Avalanche and help us improve it (see the "From Zero to Hero" Tutorial). In this case we suggest to create an environment in developer-mode as follows (just a couple of more dependencies will be installed).

Assuming you have Anaconda (or Miniconda) installed on your system, you can follow these simple steps:

  1. Install the avalanche-dev-env environment and activate it.
  2. Install Pytorch + TorchVision (follow the instructions on the website to use conda).
  3. Update the Conda Environment.

These three steps can be accomplished with the following lines of code:

# choose you python version
python="3.8"

# Step 1
git clone https://github.com/ContinualAI/avalanche.git
cd avalanche
conda create -n avalanche-dev-env python=$python -c conda-forge
conda activate avalanche-dev-env

# Step 2
# Istall Pytorch with Conda (instructions here: https://pytorch.org/)

# Step 3
conda env update --file environment-dev.yml

{% hint style="info" %} On Linux, alternatively, you can simply run the install_environment_dev.sh in the Avalanche home directory. The script takes 2 arguments: --python and --cuda_version. Check --help for details. {% endhint %}

You can test your installation by running the examples/test_install.py script. Make sure to include avalanche into your $PYTHONPATH if you are running examples with the command line interface.

That's it. now we have Avalanche up and running and we can start contribute to it!

🤝 Run it on Google Colab

You can run this chapter and play with it on Google Colaboratory:

{% embed url="https://colab.research.google.com/drive/1pSTUgftqqg2sFNlvM6ourNYLpt2lnCQf?usp=sharing" caption="Run the \"How to Install\" Chapter on Google Colab" %}