tensorflow 如何从ubuntu中完全删除cuda?

nkcskrwz  于 2023-01-05  发布在  其他
关注(0)|答案(5)|浏览(220)

我有ubuntu 18.04,不小心安装了cuda 9.1来运行Tensorflow-gpu,但似乎Tensorflow-gpu需要cuda 10.0,所以我想先通过执行以下命令删除cuda:

martin@nlp-server:~$ sudo apt-get remove --auto-remove nvidia-cuda-toolkit
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 cuda-libraries-dev-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
 cuda-samples-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
 cuda-visual-tools-10-1 : Depends: libcublas-dev (>= 10.2.0.168) but 10.1.0.105-1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

然后我尝试运行'apt --fix-broken install',但得到了以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libcublas-dev
The following packages will be upgraded:
  libcublas-dev
1 upgraded, 0 newly installed, 0 to remove and 145 not upgraded.
69 not fully installed or removed.
Need to get 0 B/39.1 MB of archives.
After this operation, 3,458 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 253408 files and directories currently installed.)
Preparing to unpack .../libcublas-dev_10.2.0.168-1_amd64.deb ...

Unpacking libcublas-dev (10.2.0.168-1) over (10.1.0.105-1) .........................................................................................................................................................................................................................................................] 
dpkg: error processing archive /var/cache/apt/archives/libcublas-dev_10.2.0.168-1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/x86_64-linux-gnu/libcublas_static.a', which is also in package nvidia-cuda-dev 9.1.85-3ubuntu1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libcublas-dev_10.2.0.168-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

如何完全删除cuda?

w8f9ii69

w8f9ii691#

有两个东西- nvidia驱动程序和cuda工具包-你可能需要删除。如果你已经使用apt-get安装了,使用下面的命令从系统中完全删除软件包:
要删除cuda工具包:

sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*"

要删除Nvidia驱动程序:

sudo apt-get --purge remove "*nvidia*"

如果您通过源文件安装(假定默认位置为/usr/local),则使用以下命令删除它:

sudo rm -rf /usr/local/cuda*

从cuda 11.4开始,提供了卸载脚本。请使用该脚本进行卸载:

# To uninstall cuda
sudo /usr/local/cuda-11.4/bin/cuda-uninstaller 
# To uninstall nvidia
sudo /usr/bin/nvidia-uninstall

如果您遇到broken packages的问题,这是在您将repo添加到apt/sources. lst后发生的。运行以下命令将其删除:

sudo vim /etc/apt/sources.list

转到包含Nvidia repo引用的行,并通过在该行前面追加#对其进行注解,例如:

#deb http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /

那就跑

sudo apt-get update

这将解决问题。
参考:Nvidia卸载

kmynzznz

kmynzznz2#

我解决了这个问题如下:

sudo apt-get purge nvidia*
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /usr/local/cuda*

这就行了。

qyzbxkaa

qyzbxkaa3#

转到- /usr/本地/cuda-10.2/bin
运行sudo ./cuda-uninstaller
选中所有选项,然后它将被自动卸载

8nuwlpux

8nuwlpux4#

要删除CUDA工具包:

$ sudo apt-get --purge remove "*cublas*" "*cufft*" "*curand*" \
 "*cusolver*" "*cusparse*" "*npp*" "*nvjpeg*" "cuda*" "nsight*"

要删除NVIDIA驱动程序:

$ sudo apt-get --purge remove "*nvidia*"

要清除卸载:

$ sudo apt-get autoremove

来源:NVIDIA安装指南

lmyy7pcs

lmyy7pcs5#

删除CUDA工具包:

sudo apt-get --purge remove "*cublas*" "*cufft*" "*curand*" "*cusolver*" "*cusparse*" "*npp*" "*nvjpeg*" "cuda*" "nsight*"

相关问题