Install Tensorflow2 or PyTorch/MONAI-dev with conda

Create a TensorFlow conda environment

  1. If not already installed, download and install conda (anaconda)
  2. If not done, finalize conda installation and configuration (adjust the string of PATH_TO_CONDA)
    1. $ source PATH_TO_CONDA/anaconda3/bin/activate
    2. $ conda init
  3. Download TF2.16-cuda.yml
  4. Create the conda environment with the yml file you want (this example will create it in /tmp)
    1. $ conda env create --prefix /tmp/${USER}/conda_TF2.16-cuda -f TF2.16-cuda.yml
  5. Activate the environment $ conda activate /tmp/${USER}/conda_TF2.16-cuda
  6. You can now enjoy your virtual environment ! For windows, remove the cupti package. If you have not a GPU (or not a nvidia one) remove lines cudnn and cudatoolkit
  7. When you want to stop an environment, you can deactivate it and restore the initial one (base) with : $ conda deactivate

A short summary of conda utilization:

This procedure is the same for PyTorch, just download monai-dev.yml and adapt the previous lines. This file includes MONAI-dev prerequisits.

$ conda env create --prefix /tmp/${USER}/monai-dev -f monai-dev.yml

then finalize the MONAI-dev installation by first activate your env and then installing the MOANI-dev using (more information here):

$ conda activate /tmp/${USER}/monai-dev
$ pip install --no-build-isolation git+https://github.com/Project-MONAI/MONAI#egg=monai


by

Tags: