For deeplabcut specifically, there are two main reasons you hit this error:
(1) wrong versions, see my first answer.
(2) too small of a GPU; to limit this, we do not allow_growth automatically, as it can crash. But, if you want to change this you can actually just pass this when you train (vs. setting env variable):
train_network(config, shuffle=1, trainingsetindex=0, max_snapshots_to_keep=5, displayiters=None, saveiters=None, maxiters=None, allow_growth=False, gputouse=None, autotune=False, keepdeconvweights=True, modelprefix='')
i.e., just pass allow_growth=True