首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将Colab上的CUDA版本降级至9

将Colab上的CUDA版本降级至9
EN

Stack Overflow用户
提问于 2020-03-24 21:24:18
回答 1查看 3.1K关注 0票数 2

当尝试在Google Colab上运行存储库时,我得到以下错误:

代码语言:javascript
运行
复制
torch.__version__  =  1.0.0.dev20190328
setup.py:46: UserWarning: Option --pyprof not specified. Not installing PyProf dependencies!
  warnings.warn("Option --pyprof not specified. Not installing PyProf dependencies!")

Compiling cuda extensions with
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
from /usr/local/cuda/bin

Traceback (most recent call last):
  File "setup.py", line 106, in <module>
    check_cuda_torch_binary_vs_bare_metal(torch.utils.cpp_extension.CUDA_HOME)
  File "setup.py", line 80, in check_cuda_torch_binary_vs_bare_metal
    "https://github.com/NVIDIA/apex/pull/323#discussion_r287021798.  "
RuntimeError: Cuda extensions are being compiled with a version of Cuda that does not match the version used to compile Pytorch binaries.  Pytorch binaries were compiled with Cuda 9.0.176.
In some cases, a minor-version mismatch will not cause later errors:  https://github.com/NVIDIA/apex/pull/323#discussion_r287021798.  You can try commenting out this check (at your own risk).

从那以后,我明白了我需要将我的CUDA版本降级到9.0.176,我使用以下代码做到了这一点:

代码语言:javascript
运行
复制
!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
!apt-get update
!apt-get install cuda=9.0.176-1

我买了here

但是,这不起作用,因为我得到了这个错误:

代码语言:javascript
运行
复制
--2020-03-24 13:15:36--  https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
Resolving developer.nvidia.com (developer.nvidia.com)... 152.199.16.29
Connecting to developer.nvidia.com (developer.nvidia.com)|152.199.16.29|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb?IMScfi-W1zJ3Wp79Q-2RqX_moDmC9pYGLUriU9OhSPrFsuIxAhKh1BXgcR44eXnLGT4UkrlBdf7n4-3q2GgZxCZgAgkNkxxA4EOyDDQVN5B_eqXLWnuSXZKWVOny13D5KOi8HalLDi7hNAbqlNn2ba7I5BS2m6aSWEX-g121qZ-ZGMzK2cyAyJcE0wEAtKDtJNfSiGnBAiGJ9knSIHDU [following]
--2020-03-24 13:15:37--  https://developer.download.nvidia.com/compute/cuda/9.0/secure/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64.deb?IMScfi-W1zJ3Wp79Q-2RqX_moDmC9pYGLUriU9OhSPrFsuIxAhKh1BXgcR44eXnLGT4UkrlBdf7n4-3q2GgZxCZgAgkNkxxA4EOyDDQVN5B_eqXLWnuSXZKWVOny13D5KOi8HalLDi7hNAbqlNn2ba7I5BS2m6aSWEX-g121qZ-ZGMzK2cyAyJcE0wEAtKDtJNfSiGnBAiGJ9knSIHDU
Resolving developer.download.nvidia.com (developer.download.nvidia.com)... 152.199.20.126
Connecting to developer.download.nvidia.com (developer.download.nvidia.com)|152.199.20.126|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1212738714 (1.1G) [application/x-deb]
Saving to: ‘cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb.2’

cuda-repo-ubuntu160 100%[===================>]   1.13G  64.0MB/s    in 18s     

2020-03-24 13:15:55 (64.6 MB/s) - ‘cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb.2’ saved [1212738714/1212738714]

(Reading database ... 157958 files and directories currently installed.)
Preparing to unpack cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb ...
Unpacking cuda-repo-ubuntu1604-9-0-local (9.0.176-1) ...
dpkg-deb (subprocess): cannot copy archive member from 'cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb' to decompressor pipe: unexpected end of file or stream
dpkg-deb (subprocess): decompressing archive member: lzma error: unexpected end of input
dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb (--install):
 cannot copy extracted data for './var/cuda-repo-9-0-local/cuda-visual-tools-9-0_9.0.176-1_amd64.deb' to '/var/cuda-repo-9-0-local/cuda-visual-tools-9-0_9.0.176-1_amd64.deb.dpkg-new': unexpected end of file or stream
Errors were encountered while processing:
 cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
gpg: can't open '/var/cuda-repo-9-0-local/7fa2af80.pub': No such file or directory
Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Hit:3 http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu bionic InRelease
Hit:4 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:5 http://ppa.launchpad.net/marutter/c2d4u3.5/ubuntu bionic InRelease
Hit:6 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:7 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease
Ign:8 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  InRelease
Ign:9 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  InRelease
Hit:10 https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64  Release
Hit:11 https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64  Release
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Version '9.0.176-1' for 'cuda' was not found

我认为我正在尝试下载的CUDA版本找不到,因为它在底部说明。如何才能正确找到CUDA下载的版本才能降级?

EN

回答 1

Stack Overflow用户

发布于 2020-03-26 11:29:41

使用apt安装Cuda有时在colab中不起作用你可以检查一下

!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb

!sudo sh cuda-repo-ubuntu1704-9-0-local_9.0.176-1_amd64-deb

!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/patches/4/cuda-repo-ubuntu1704-9-0-176-local-patch-4_1.0-1_amd64-deb

!sudo sh cuda-repo-ubuntu1704-9-0-176-local-patch-4_1.0-1_amd64-deb

!export PATH=$PATH:/usr/local/cuda-9.0/bin

!export CUDADIR=/usr/local/cuda-9.0

!导出LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64

!pip3安装https://download.pytorch.org/whl/cu90/torch-1.0.0-cp36-cp36m-linux_x86_64.whl

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60831967

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档