Skip to content

DeepLabCut Installation

Carlos Lizarraga-Celaya edited this page Aug 15, 2024 · 6 revisions

(Credit: Nick Morrison, Unsplash.com)


We are going to follow the installation instructions that are given on the installation documentation page.

Installation on a MacBook (M1 chip/Intel)

Download the miniconda suite

We use the recommended miniconda installation. You can download the appropriate miniconda installer from the Anaconda site. Select the platform: Intel or Apple M1. You can do a graphical installation (pkg) or via terminal (bash). The pkg installation is easier.


PyTorch installation

We start installing PyTorch

Step 1: Create a new conda environment

conda create --name deeplabcut python=3.10

Step 2: Activate the conda enviroment

conda activate deeplabcut

(This environment is created under /opt/miniconda3/envs, in case you want to undo everything.)

Step 3: Install PyTorch

Paste the below code in the terminal (make sure you’re in the env)

conda install pytorch::pytorch torchvision torchaudio -c pytorch

Reference: Pytorch for Mac M1/M2 with GPU acceleration 2023. Jupyter and VS Code setup for PyTorch included.. Mustafa Mujahid. Medium, 2023.

Tensorflow installation

If you use MacOS/Linux, you can take advantage of the Homebrew software administration tool, to manage open source software.

If you haven't installed brew yet, run the following script from a terminal shell

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 1: We will use brew to install

brew install hdf5

Step 2: Install the tensorflow package for macos if M1 chip.

pip install tensorflow-macos

and

Step 3: Install the GPU accelerator for Apple M1

pip install tensorflow-metal

Reference: TensorFlow with GPU support on Apple Silicon Mac with Homebrew and without Conda / Miniforge. Søren L Kristiansen. Medium, 2022.


DeepLabCut 3.0 installation

We describe a series of steps to install DeepLabCut, with pytorch support.

Step 1: Install tensorpack

conda install hcc::tensorpack

Step 2: Install tf_slim

conda install conda-forge::tf_slim

Step 3: Install pytables

conda install -c conda-forge pytables==3.8.0

Step 4: Install DeepLabCut source form Github

pip install "git+https://github.com/DeepLabCut/DeepLabCut.git@pytorch_dlc#egg=deeplabcut[gui,modelzoo,wandb]"

If there are no missing packages, then you are ready to run deeplabcut

python -m deeplabcut

Then you will get the active GUI

You are ready to start with your projects.

Use command Q in the MacBook to finish.


Created: 08/09/2024 (C. Lizárraga)

Updated: 08/15/2024 (C. Lizárraga)

DataLab, Data Science Institute, University of Arizona.

CC BY-NC-SA 4.0