Problems importing DLC on a cluster server

I’m trying to run DLC remotely on a GPU cluster and having problems importing. My local PC is Windows 10 and I’m running DeepLabCut 2.0.8, trying to run through the cluster using Putty.

I tried loading the premade environments from the deeplabcut website but it didn’t seem to work so I am following instructions from a previous lab member on how to create the appropriate environment.

Here is how I’m creating my environment:
module load anaconda3/5.3.1 cudatoolkit/9.2 cudnn/cuda-9.2/7.3.1
conda create -n deeplabcut python=3.6
conda activate deeplabcut
pip install deeplabcut
conda install wxPython=4.0.3
pip install tensorflow-gpu==1.8
import deeplabcut

I always get an error message that ends with this error:
ImportError: Cannot load backend ‘TkAgg’ which requires the ‘tk’ active framework, as “headless” is currently running.

I’ve tried uninstalling and reinstalling matplotlib==3.0.3 but it hasn’t changed anything.

I’ve been able to successfully run DLC on my local machine so I think it’s a problem with the environment creation but I don’t know how to fix it.

1 Like

Hi Victoria,

On clusters, servers etc. one should set a backend. Indeed, that error appears because natively everything is imported (for GUI support) when you import deeplabcut . For running DeepLabCut on certain platforms (such as AWS, Google, or on a University cluster) you will need to suppress the GUI support. This can be done by setting an “environment variable” before loading the

Linux: export DLClight=True
Windows: set DLClight=True

If you want to re-engage the GUIs (and have installed wxPython as described above):

Linux: unset DLClight
Windows: set DLClight=

More info at: and

Also check out page 2158 in the nature protocols paper.


1 Like