PyTorch causing problems with CUDA on Colab

I am trying to implement a face extraction model using Colab. For that, I am removing Colab’s CUDA to install 10-2 and I’m also installing Anaconda. This is the entirety:

import condacolab, torch, sys, skimage, matplotlib, imageio, plotly, cv2, black, flake8, facenet_pytorch

from google.colab import drive

!git clone
!cp /content/gdrive/MyDrive/ /content/gdrive/MyDrive/ /content/
!cp /content/gdrive/MyDrive/ .
!unzip -qq /content/
!unzip -qq /content/ReconNet-PyTorch/images/all\ images/

!mv /content/ReconNet-PyTorch/*.py /content/
!mkdir results

!apt-get update -y
!apt-get --purge remove "*cublas*" "cuda*" "nsight*" 

!mv /etc/apt/preferences.d/cuda-repository-pin-600
!dpkg -i cuda-repo-ubuntu1804-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
!apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/
!apt-get install cuda-10-2 libtorch -y
!apt autoremove -y

!chmod 777


!conda update conda
!conda create -n pytorch3d python=3.9
!conda activate pytorch3d
!conda install -c pytorch pytorch=1.9.1 torchvision cudatoolkit=10.2
!conda install -c fvcore -c iopath -c conda-forge fvcore iopath

!conda install -c bottler nvidiacub

!conda install jupyter
!conda install pytorch3d -c pytorch3d

pyt_version_str = torch.__version__.split("+")[0].replace(".", "")
version_str="".join([f"py3{sys.version_info.minor}_cu", torch.version.cuda.replace(".",""), f"_pyt{pyt_version_str}"])
!pip3 install --no-index --no-cache-dir pytorch3d -f{version_str}/download.html
!export CUB_HOME=$PWD/cub-1.10.0

!pip3 install "git+"

!rm -rf sample_data/ *.sh *.run

And this is the error I get when I try to run a Python file…

/usr/local/lib/python3.7/site-packages/torchvision/io/ UserWarning: Failed to load image Python extension: /usr/local/lib/python3.7/site-packages/torchvision/ undefined symbol: _ZNK2at10TensorBase21__dispatch_contiguousEN3c1012MemoryFormatE
  warn(f"Failed to load image Python extension: {e}")
Traceback (most recent call last):
  File "", line 2, in <module>
    from core.options import ImageFittingOptions
  File "/content/3DMM-Fitting-Pytorch/core/", line 1, in <module>
    from core.BFM09Model import BFM09ReconModel
  File "/content/3DMM-Fitting-Pytorch/core/", line 5, in <module>
    from core.BaseModel import BaseReconModel
  File "/content/3DMM-Fitting-Pytorch/core/", line 5, in <module>
    from pytorch3d.renderer import (
  File "/usr/local/lib/python3.7/site-packages/pytorch3d/renderer/", line 7, in <module>
    from .blending import (
  File "/usr/local/lib/python3.7/site-packages/pytorch3d/renderer/", line 11, in <module>
    from pytorch3d import _C
ImportError: cannot open shared object file: No such file or directory

Where am I going wrong?