Skip to content

Installation

Requirements

  • OS: Linux (Ubuntu 22.04 recommended). Windows 10 is also supported but might be trickier to setup. MacOS is untested.
  • Python: 3.10
  • CUDA: 12.6 — You can install CUDA by following the NVIDIA CUDA installation guide, or directly downloading it from this link. The command nvcc --version should show version 12.6.

Step-by-step

1. Clone the repository

git clone https://github.com/hugobaudchon/CanopyRS.git
cd CanopyRS

2. Create a conda environment with mamba

conda create -n canopyrs -c conda-forge python=3.10 mamba
conda activate canopyrs

3. Install GDAL via mamba

mamba install gdal=3.6.2 -c conda-forge

4. Install PyTorch with CUDA 12.6 support

pip install torch==2.7.1 torchvision==0.22.1 --index-url https://download.pytorch.org/whl/cu126

5. Initialize submodules

git submodule update --init --recursive

6. Install CanopyRS and dependencies

python -m pip install -e .
python -m pip install --no-build-isolation -e ./detrex/detectron2 -e ./detrex

SAM 3 — Hugging Face access request

SAM 3 is a gated model hosted by Meta on Hugging Face. If you plan to use SAM 3 (either directly or through a SAM 3 preset), you must request access before your first run:

  1. Go to the facebook/sam3 model page on Hugging Face.
  2. Click "Request access" and accept Meta's license terms.
  3. Make sure you are logged in to Hugging Face on your machine:
    huggingface-cli login
    

Without this step, any pipeline using SAM 3 will fail when trying to download the base model weights.

Known issues

You will likely encounter this error during installation:

sam2 0.4.1 requires iopath>=0.1.10, but you have iopath 0.1.9 which is incompatible

This is a conflict between Detectron2 and SAM2 libraries, but it can be ignored and should not impact installation or usage of the pipeline.

Verify the installation

python -c "import canopyrs; print('CanopyRS installed successfully')"