- Linux or macOS (Windows is in experimental support)
- Python 3.6+
- PyTorch 1.3+
- CUDA 9.2+ (If you run using GPU)
-
Create a conda virtual environment and activate it.
conda create -n coala python=3.7 -y conda activate coala
-
Install PyTorch and torchvision following the official instructions, e.g.,
conda install pytorch torchvision -c pytorch
or
pip install torch==1.10.1 torchvision==0.11.2
-
You can skip the following CUDA-related content if you plan to run it on CPU.
Note: Make sure that your compilation CUDA version and runtime CUDA version match. You can check the supported CUDA version for precompiled packages on the PyTorch website.
E.g.,
1. If you have CUDA 10.1 installed under/usr/local/cuda
and would like to install PyTorch 1.5, you need to install the prebuilt PyTorch with CUDA 10.1.conda install pytorch cudatoolkit=10.1 torchvision -c pytorch
E.g.,
2. If you have CUDA 9.2 installed under/usr/local/cuda
and would like to install PyTorch 1.3.1., you need to install the prebuilt PyTorch with CUDA 9.2.conda install pytorch=1.3.1 cudatoolkit=9.2 torchvision=0.4.2 -c pytorch
If you build PyTorch from source instead of installing the prebuilt package, you can use more CUDA versions such as 9.0.
pip install coala-fl
Assuming that you already have CUDA 10.1 installed, here is a full script for setting up COALA with conda.
conda create -n coala python=3.7 -y
conda activate coala
# Without GPU
conda install pytorch==1.6.0 torchvision==0.7.0 -c pytorch -y
# With GPU
conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.1 -c pytorch -y
# install coala
pip install coala-fl
To verify whether COALA is installed correctly, we can run the following sample code to test.
import coala
coala.init()
The above code is supposed to run successfully after you finish the installation.