Pin TensorFlow according to OS; Fix DeepLabCut install in Colab to deal with new requirements. by n-poulsen · Pull Request #2862 · DeepLabCut/DeepLabCut

This pull request sets the TensorFlow pin to version 2.10 for windows, and version <=2.12 for other OSs. It also updates the installation method for DeepLabCut in COLAB notebooks, to match current requirements. The updated install is faster than the old install. To TensorFlow 2.12 working with the GPU in COLAB, one needs to run (in this order):

# Cell 1 - Install the desired TensorFlow version, built for CUDA 11.8 and cudnn 8
!pip install "tensorflow==2.12.1" "tensorpack>=0.11" "tf_slim>=1.1.0"

# Cell 2 - Downgrade PyTorch to a version using CUDA 11.8 and cudnn 8
#   This should also install the required CUDA libraries, for both PyTorch and TensorFlow
!pip install torch==2.3.1 torchvision --index-url https://download.pytorch.org/whl/cu118

# Cell 3
# As described in https://www.tensorflow.org/install/pip#step-by-step_instructions:
# Create symbolic links to NVIDIA shared libraries
!ln -svf /usr/local/lib/python3.11/dist-packages/nvidia/*/lib/*.so* /usr/local/lib/python3.11/dist-packages/tensorflow

Then DeepLabCut can be installed with the desired version (e.g. pip install deeplabcut or pip install "git+https://github.com/DeepLabCut/DeepLabCut.git)

Closes #2839