First thing first, clone the sam2 repository from meta, as we are working with it:
git clone https://github.com/facebookresearch/sam2.git
Also rember to download the requirements (which are copied from sam2):
pip install -r requirements.txt
Sam2 is already put into .gitignore, so it should be fine, but remember to delete the .git folder inside sam2, just to be sure.
Then install the weights of sam2:
cd sam2/checkpoints
download_ckpts.sh