Installing DeepLabCut#

  • DeepLabCut can be run on Windows, Linux, or MacOS as long as you have Python 3.10-3.12 installed

  • 🚧 Please note, there are several possibilities for installation:

    • Recommended for most users: Install in a conda environment

    • Install with uv (recommended for developers)

    • In the supplied Docker container (recommended for Ubuntu advanced users and reproducibility).

  • 🚀 You will get the best performance when using a GPU!

    • Please see the section on GPU support to install your GPU driver and CUDA.

Hint

Familiar with python packages and conda?

This assumes you have conda/mamba installed and this will install DeepLabCut in a fresh environment. If you have an NVIDIA GPU, install PyTorch according to their instructions (with your desired CUDA version) - you just need your GPU drivers installed.

conda create -n DEEPLABCUT python=3.12
conda activate DEEPLABCUT

# Install PyTorch with your desired CUDA version (or CPU only)
# Example: install GPU-enabled pytorch for CUDA 12.6
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu126

# install the latest version of DeepLabCut
pip install deeplabcut # add --pre for pre-release versions!
# or if you want to use the GUI
pip install deeplabcut[gui]

# ONLY IF YOU HAVE A CUDA GPU - check that PyTorch can access your GPU; this
# should print `True`
python -c "import torch; print(torch.cuda.is_available())"
  • If you’re familiar with the command line and want TensorFlow support, look below.

Using Conda#

DLC

The installation process is as easy as the figure on the right!↘️

🚨 Before you start…#

Do you have a GPU? If yes, see the GPU support section below for installation instructions.

If not, you can still install DeepLabCut and use it on your CPU, but it will be much slower for training and evaluation (but not for labeling or project management).

Step 1: Install miniconda#

Important

Download miniconda for your operating system

  • miniconda is an easy way to install Python and additional packages across various operating systems

  • With miniconda, you can install all the dependencies in an environment on your machine

  • Miniconda is a lightweight version of Anaconda that includes only conda and its dependencies.

Step 2: Build a conda environment#

Use the DEEPLABCUT.yaml file to build a conda environment with all the dependencies for DeepLabCut.

You simply need to have this .yaml file locally on your computer.

Warning

On Windows, make sure you have git installed: Git for Windows

  • Follow the link ➡️ for the conda file and then click “…” and select Download

    Screen Shot 2023-09-13 at 10 33 32 PM
  • Now, in Terminal (or Anaconda Command Prompt for Windows users):

    • If you clicked to download, go to your downloads folder.

    • Be sure you are in the folder that has the .yaml file, then run:

      conda env create -f DEEPLABCUT.yaml

  • You can now use this environment from anywhere on your computer. Just activate your environment by running: conda activate DEEPLABCUT

Now you should see (DEEPLABCUT) on the left of your terminal screen:

(DEEPLABCUT) YourName-MacBook...

Note

No need to run pip install deeplabcut, it’s already in the conda file!

TensorFlow support#

Step 3: Let’s run DeepLabCut!#

DeepLabCut is installed! 🎉💜

Launch the DeepLabCut GUI in your new conda env by running python -m deeplabcut

Head over to the User Guide Overview for information.

Warning

On Windows: Open the terminal/cmd/anaconda prompt as Administrator (right click and select “Run as administrator”) to avoid permission issues when downloading models, and for symlink support when videos are not copied into the project folder.

Conda environment management tips#

Here are some conda environment management tips: kapeli.com: Conda Cheat Sheet

Please see how to test your installation by following this video.

Other ways to install DeepLabCut#

git clone#

Recommended for users who want to modify the code, or want to be up-to-date with the latest code on GitHub.

  • To clone the repository run: git clone https://github.com/DeepLabCut/DeepLabCut.git

  • Then follow the same steps as in Step 2 above, adjusting for the DEEPLABCUT.yaml env file now being in the folder where you git cloned the repo.

  • Or use pip/uv to install from the cloned repo (see below).

pip#

If you already have a local environment, everything you need to use the project manager GUI, train and/or build custom models within DeepLabCut (i.e., use our source code and our dependencies) can be installed with pip install 'deeplabcut[gui]' (for GUI support w/PyTorch) or without the gui: pip install 'deeplabcut'.

  • If you cloned the repo and want to make edits to the code locally, navigate to the cloned repo folder and run pip install -e .[gui] to install the package in “editable” mode, which allows you to make changes to the code and have those changes reflected when you import the package.

  • If you want to use the SuperAnimal models, then please use pip install 'deeplabcut[gui,modelzoo]'.

  • If you need the TensorFlow training engine, add the tf extra (or tf-cu11 / tf-cu12 as appropriate): pip install 'deeplabcut[tf]' — see TensorFlow Support.

Docker#

  • We also have docker containers. Docker is the most reproducible way to use and deploy code. Please see our dedicated docker package and page here.

Creating your own conda environment#

Tip

In a fresh ubuntu install, you will often have to run: sudo apt-get install gcc python3-dev to install the GNU Compiler Collection and the python developing environment.

Create a new conda environment with Python 3.10 (or 3.11, 3.12) by running:

conda create -n DLC python=3.10

Current version: The only thing you then need to add to the env is deeplabcut ( pip install deeplabcut) or pip install 'deeplabcut[gui]' if you are using the GUI, which includes the napari based labeling interface.

Updating your installation#

If you ever want to update your DLC, just run pip install --upgrade deeplabcut (alongside optional needed requirements, e.g. [gui]) using your environment.

If you would like to use a specific release, then specify the version you want, such as pip install deeplabcut==3.0 and optional requirements.

Once installed, you can check the version by running:

import deeplabcut
deeplabcut.__version__

Don’t be afraid to update, DLC is backwards compatible with your 2.0+ projects and performance continues to get better and new features are added often.

Data compatibility#

All of the data you labelled in version 2.X is also compatible with version 3+ and the PyTorch engine! There is no change in the workflow or the way labels are handled: the big changes happen under-the-hood! If you’ve been working with DeepLabCut 2.X and want to learn more about moving to the PyTorch engine, check out our docs on moving from TensorFlow to PyTorch

GPU Support#

General GPU support#

Please ensure you have an NVIDIA GPU and the matching NVIDIA driver installed.

Warning

If you have a GPU, you should first install an appropriate driver for your specific GPU, then you can use the supplied conda file.

  • Drivers: see NVIDIA Drivers

  • CUDA: download here if needed. Installing the drivers usually allows you to skip installing CUDA; instead obtaining via the PyTorch installation process.

Installing CUDA and cuDNN for TensorFlow GPU support#

You will need an NVIDIA GPU that is compatible with CUDA.

To see a list of CUDA-enabled NVIDIA GPUs, please see their website.

Here we provide notes on how to install and check your GPU use with TensorFlow, which is used by DeepLabCut.

  1. Install a driver for your GPU, using the NVIDIA Drivers link above.

    • Check which driver is installed by typing this into the terminal: nvidia-smi.

  2. Install CUDA. Note that cuDNN is supplied inside the anaconda environment files, so you don’t need to install it again.

  3. Follow the steps above to get the DEEPLABCUT conda file and install it!

Notes#

  • As of version 3.0+ the default engine is PyTorch. TensorFlow remains optional via pip install "deeplabcut[tf]" and related extras; version ranges are defined in pyproject.toml (typically TensorFlow 2.12+ on supported Python versions). Upstream, native Windows GPU for TensorFlow stopped after 2.10. We advise Windows users to install WSL. We do not guarantee every future TensorFlow release for all platforms.

  • Please be mindful different versions of TensorFlow require different CUDA versions.

  • As the combination of TensorFlow and CUDA matters, we strongly encourage you to check your driver/cuDNN/CUDA/TensorFlow versions on this StackOverflow post.

  • To check your GPU is working, in the terminal, run:

    nvcc -V to check your installed version(s).

  • The best practice is to then run the supplied testscript_pytorch_single_animal.py (or testscript_tensorflow_single_animal.py for the TensorFlow engine); this is inside the examples folder you acquired when you git cloned the repo. Here is more information/a short video on running the test scripts.

  • You can test that your GPU is being properly used with these additional tips.

  • Ubuntu users might find this installation guide for a fresh DLC install on Ubuntu useful as well.

Troubleshooting#

TensorFlow#

Here are some additional resources users have found helpful (posted without endorsement):

FFMPEG#

DeepLabCut#

  • If you git clone or download this folder, and are inside of it then import deeplabcut will import the package from the local folder rather than from the latest on PyPi!

System-wide installation considerations#

Note

What is a system-wide installation?

A system-wide installation, or a base environment installation, is when you install using the default Python environment/interpreter on your computer, instead of a compartmentalized, separate environment (e.g., a conda environment).

This is often a source of conflicts between packages, user confusion and progressive “dependency hell” (where you have to keep installing and uninstalling packages to get the right versions for different applications).

To avoid this, we recommend using a virtual environment (e.g., conda or uv managed environments) to keep your DeepLabCut installation separate from other Python packages and applications on your system.

If you perform a system-wide/base environment installation, and the computer has other Python packages or TensorFlow versions installed that conflict, this will overwrite them.

If you have a dedicated machine for DeepLabCut, this may be temporarily fine, but will degrade over time as you try to install or update other packages.

Indeed, if there are other applications that require different versions of libraries, then installing/updating anything would potentially break those applications.

One way to manage virtual environments is to use conda environments (for which you need Anaconda/miniconda installed). An environment is a self-contained directory that contains a Python installation for a particular version of Python, plus additional packages, without any cross-talk with other environments (NVIDIA drivers being a notable exception, as they are system-wide by nature).

Hardware considerations#

  • Computer:

    • For reference, we use e.g. Dell workstations (79xx series) with Ubuntu 16.04 LTS, 18.04 LTS, 20.04 LTS, 22.04 LTS and for versions prior to 2.2, we run a Docker container that has TensorFlow, etc. installed (DeepLabCut/Docker4DeepLabCut2.0). Now we use the new Docker containers supplied on this repo (linux support only), also available through DockerHub or the deeplabcut-docker helper script.

  • Computing Hardware:

    • An NVIDIA GPU with at least 8GB VRAM (memory) is ideal.

    • A GPU is not strictly necessary, but on a CPU the (training and evaluation) code is considerably slower (10x) for ResNets, but MobileNets are faster. You might also consider using cloud computing services like Google cloud/amazon web services or Google Colaboratory.

  • Camera Hardware:

    • The software is very robust to variations stemming from various cameras (cell phone cameras, grayscale, color; captured under infrared light, different manufacturers, etc.). See demos on our website.

    • Note that a model trained on certain data/camera may not generalize to data from a different camera however, so we recommend using the same camera for training and inference.

  • Software:

    • Operating System: Linux (Ubuntu), MacOS[1] (Mojave), or Windows 10. However, we the authors strongly recommend Ubuntu!

    • DeepLabCut is written in Python 3 (https://www.python.org/) and not compatible with Python 2.