%env not update after downgrade CUDA from 12.2 to 11.7 on Google Colab

171 Views Asked by At

When i use my Colab GPU to train Handwriting Recognition based on PaddleOCR pipeline, i have to downgrade its CUDA to 11.7 so it can work well with PaddleOCR, i check !nvcc -V its got updated but when i use %env its still have CUDA 12.2 all over it.

I used these code to delete the old CUDA

!sudo apt --purge remove "cublas*" "cuda*"
!sudo apt --purge remove "nvidia*"
!rm -rf /usr/local/cuda*
!sudo apt-get autoremove && sudo apt-get autoclean

then

!sudo apt-get install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

and

!wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
!sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
!wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda-repo-ubuntu1804-11-7-local_11.7.0-515.43.04-1_amd64.deb
!sudo dpkg -i cuda-repo-ubuntu1804-11-7-local_11.7.0-515.43.04-1_amd64.deb
!sudo cp /var/cuda-repo-ubuntu1804-11-7-local/cuda-*-keyring.gpg /usr/share/keyrings/
!sudo apt-get update
!sudo apt-get -y install cuda-11-7

to install CUDA 11-7 and

!echo 'export PATH=/usr/local/cuda-12.1/bin:$PATH' >> ~/.bashrc
!echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.1/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
!source ~/.bashrc

i also install cudnn by

!sudo apt install ./drive/MyDrive/cudnn-local-repo-ubuntu1804-8.9.0.131_1.0-1_amd64.deb
!sudo cp /var/cudnn-local-repo-ubuntu1804-8.9.0.131/cudnn-local-A18C0B21-keyring.gpg /usr/share/keyrings/

when i check by !nvcc -V it got

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0

but when i check by %env it still have 12.2 version all over it How do i know my downgrade work ?

0

There are 0 best solutions below