Win10:安装pytorch1.1.0+cudatoolkit9.0

阅读: 评论:0

Win10:安装pytorch1.1.0+cudatoolkit9.0

Win10:安装pytorch1.1.0+cudatoolkit9.0

文章目录

    • 1. 查看CUDA的版本
      • 1.1 CUDA runtime version
      • 1.2 CUDA driver version
    • 2. 安装PyTorch
      • 2.1 去pytorch官网下载指定版本的pytorch
      • 2.2 添加清华通道
      • 2.3 安装

1. 查看CUDA的版本

CUDA有两个主要API,即运行时API和驱动程序API。两者都有对应的版本。

  • 对驱动程序API的必要支持由GPU驱动程序安装程序安装。
  • 对运行时API的必要支持是由CUDA工具包安装程序安装的,它也可能有一个GPU驱动程序安装程序捆绑在里面。

在一些情况下,已安装驱动程序API版本可能并不总是与已安装运行时API版本匹配,特别是当你安装一个独立于安装CUDA(即CUDA工具包)的GPU驱动程序时。

1.1 CUDA runtime version

the CUDA compiler-driver tool that is installed with the CUDA toolkit.

nvcc是与CUDA工具包一起安装的CUDA编译驱动工具,它总是报告CUDA运行时的版本,而CUDA运行时的版本是它构建时要识别的。它不知道安装了什么驱动版本,甚至不知道是否安装了GPU驱动。

  1. 方式一
    命令行输入:nvcc --version
  2. 方式二
    查找安装目录的版本说明,一般安装目录都在C:Program FilesNVIDIA GPU Computing ToolkitCUDA下。

1.2 CUDA driver version

nvidia-smi工具由GPU驱动程序的安装程序安装,并且通常在视图中有GPU驱动程序。

  1. 方式一
    从NVIDIA的控制面板中查看版本信息。
  2. 方式二
    命令行:nvidia-smi

因此,从设计上来说,这两个数字不一定是匹配的,因为它们反映了两种不同的东西。

在大多数情况下,如果nvidia-smi报告的CUDA版本在数值上等于或高于nvcc -V查询的CUDA版本,则无需担心。这是CUDA(较新的驱动程序/驱动程序API支持较旧的CUDA工具包/运行时API)中定义的兼容性路径。

例如,如果nvidia-smi报告CUDA 10.2,并nvcc -V报告CUDA 10.1,则通常不必担心。它应该可以正常工作,并不一定意味着您“当您打算安装CUDA 10.1时实际上已经安装了CUDA 10.2”

如果nvcc命令根本不报告任何内容(例如Command 'nvcc' ),则也可能是由于CUDA安装不正确。

概括自:Different CUDA versions shown by nvcc and NVIDIA-smi

2. 安装PyTorch

2.1 去pytorch官网下载指定版本的pytorch

到官网选择安装的环境:【 PyTorch】

根据自己的本机配置(cudatoolkit=9.0)生成anaconda安装pytorch的命令:

conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0 -c pytorch

2.2 添加清华通道

在conda的配置文件中,添加Pytorch的清华源:

channels:-     /
ssl_verify: true
show_channel_urls: true

2.3 安装

需要注意的是,最后这个指令是从官网的指令去掉-c pytorch

conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0
(CCNet) C:Users86571>conda install pytorch==1.1.0 torchvision==0.3.0 cudatoolkit=9.0
Collecting package metadata (repodata.json): done
Solving environment: |
Warning: >10 possible package resolutions (only showing differing packages):- ::pip-20.2.4-py_0, ::wheel-0.35.1-pyh9f0ad1d_0, ::vc-14.1-h869be7e_1, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::wheel-0.35.1-pyh9f0ad1d_0, ::pip-20.2.4-py_0, ::vc-14.1-h869be7e_1, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::pip-20.2.4-py_0, ::wheel-0.35.1-pyh9f0ad1d_0, ::vc-14.1-h869be7e_1, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::pip-20.2.4-py_0, ::wheel-0.35.1-pyh9f0ad1d_0, ::vc-14.1-h869be7e_1, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::pip-20.2.4-py_0, ::vc-14.1-h869be7e_1, ::wheel-0.35.1-pyh9f0ad1d_0, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::pip-20.2.4-py_0, ::wheel-0.35.1-pyh9f0ad1d_0, ::vc-14.1-h869be7e_1, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::vc-14.1-h869be7e_1, ::pip-20.2.4-py_0, ::wheel-0.35.1-pyh9f0ad1d_0, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::wheel-0.35.1-pyh9f0ad1d_0, ::vc-14.1-h869be7e_1, ::pip-20.2.4-py_0, ::vs2015_runtime-14.16.27012-h30e32a0_2- ::vc-14.1-h869be7e_1, ::vs2015_runtime-14.16.27012-h30e32a0_2, ::pip-20.2.4-py_0, ::wheel-0.35.1-pyh9f0ad1d_0- ::vs2015_runtime-14.16.27012-h30e32a0_2, ::pip-20.2.4-py_0, ::wheel-0.35.1-pyh9f0ad1d_0, ::vc-14. and othedone==> WARNING: A newer version of conda exists. <==current version: 4.8.5latest version: 4.9.2Please update conda by running$ conda update -n base condaWARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:CodingSoftwareAnaconda3pkgspytorch-1.1.0-py3.7_cuda90_cudnn7_1.tar.bz2.  Please remove this file manually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:CodingSoftwareAnaconda3pkgspytorch-1.1.0-py3.7_cuda90_cudnn7_1Libsite-packagestorchincludepybind11chrono.h.  Please remove this file manually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:CodingSoftwareAnaconda3pkgspytorch-1.7.0-py3.7_cuda110_cudnn8_0.tar.bz2.  Please remove this file manually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:CodingSoftwareAnaconda3pkgspytorch-1.7.0-py3.7_cuda110_cudnn8_0infopaths.json.  Please remove this file manually (you may need to reboot to free file handles)## Package Plan ##environment location: D:CodingSoftwareAnaconda3envsCCNetadded / updated specs:- cudatoolkit=9.0- pytorch==1.1.0- torchvision==0.3.0The following packages will be downloaded:package                    |            build---------------------------|-----------------blas-1.0                   |              mkl           6 KB  .10.14 |                0         159 KB  .6.20          |     pyhd3eb1b0_3         159 KB  .14.3                |   py37h7a1dbc1_0         226 KB  .0            |                1       339.8 MB  .10.4            |       hd328e21_0         490 KB  .2        |              254         2.0 MB                      |       hb83a4c4_2         313 KB  .6.37              |       h2a8f88b_0         598 KB  .1.0              |       h56a325e_1         1.1 MB  .9.2                |       hf4a77e7_3         121 KB  .2                 |              256       170.7 MB  .3.0          |   py37hb782905_0         200 KB  .2.0              |   py37h45dec08_0         135 KB  .1.1           |   py37h47e9c7a_0         272 KB  .10.1               |   py37h7ef1ec2_0         275 KB  .19.2               |   py37hadc3359_0          21 KB  .19.2          |   py37ha3acd2a_0         4.8 MB  .46               |           py37_0          49 KB  .1.1h             |       he774522_0         5.8 MB  .0.1               |   py37h4fa10fc_0         736 KB  .20             |             py_2          94 KB  .1.0              |py3.7_cuda90_cudnn7_1       427.2 MB  .15.0                 |   py37haa95532_0          50 KB  .6.10                  |       he774522_0         3.2 MB  .3.0          |      py37_cu90_1         2.3 MB  .2.5                   |       h62dcd97_0         333 KB  .2.11                |       h62dcd97_4         132 KB  .4.5                 |       h04227a9_0         837 KB  :       961.9 MBThe following NEW packages will be INSTALLED:blas               anaconda/pkgs/main/win-64::blas-1.0-mklcffi               anaconda/pkgs/main/win-64::cffi-1.14.3-py37h7a1dbc1_0cudatoolkit        anaconda/pkgs/main/win-64::cudatoolkit-9.0-1freetype           anaconda/pkgs/main/win-64::freetype-2.10.4-hd328e21_0intel-openmp       anaconda/pkgs/main/win-64::intel-openmp-2020.2-254jpeg               anaconda/pkgs/main/win-64::jpeg-9b-hb83a4c4_2libpng             anaconda/pkgs/main/win-64::libpng-1.6.37-h2a8f88b_0libtiff            anaconda/pkgs/main/win-64::libtiff-4.1.0-h56a325e_1lz4-c              anaconda/pkgs/main/win-64::lz4-c-1.9.2-hf4a77e7_3mkl                anaconda/pkgs/main/win-64::mkl-2020.2-256mkl-service        anaconda/pkgs/main/win-64::mkl-service-2.3.0-py37hb782905_0mkl_fft            anaconda/pkgs/main/win-64::mkl_fft-1.2.0-py37h45dec08_0mkl_random         anaconda/pkgs/main/win-64::mkl_random-1.1.1-py37h47e9c7a_0ninja              anaconda/pkgs/main/win-64::ninja-1.10.1-py37h7ef1ec2_0numpy              anaconda/pkgs/main/win-64::numpy-1.19.2-py37hadc3359_0numpy-base         anaconda/pkgs/main/win-64::numpy-base-1.19.2-py37ha3acd2a_0olefile            anaconda/pkgs/main/win-64::olefile-0.46-py37_0pillow             anaconda/pkgs/main/win-64::pillow-8.0.1-py37h4fa10fc_0pycparser          anaconda/pkgs/main/noarch::pycparser-2.20-py_2pytorch            anaconda/cloud/pytorch/win-64::pytorch-1.1.0-py3.7_cuda90_cudnn7_1six                anaconda/pkgs/main/win-64::six-1.15.0-py37haa95532_0tk                 anaconda/pkgs/main/win-64::tk-8.6.10-he774522_0torchvision        anaconda/cloud/pytorch/win-64::torchvision-0.3.0-py37_cu90_1xz                 anaconda/pkgs/main/win-64::xz-5.2.5-h62dcd97_0zlib               anaconda/pkgs/main/win-64::zlib-1.2.11-h62dcd97_4zstd               anaconda/pkgs/main/win-64::zstd-1.4.5-h04227a9_0The following packages will be SUPERSEDED by a higher-priority channel:ca-certificates    anaconda/cloud/conda-forge::ca-certif~ --> anaconda/pkgs/main::ca-certificates-2020.10.14-0certifi            anaconda/cloud/conda-forge/win-64::ce~ --> anaconda/pkgs/main/noarch::certifi-2020.6.20-pyhd3eb1b0_3openssl                        anaconda/cloud/conda-forge --> anaconda/pkgs/mainProceed ([y]/n)? yDownloading and Extracting Packages
six-1.15.0           | 50 KB     | ############################################################################ | 100%
certifi-2020.6.20    | 159 KB    | ############################################################################ | 100%
blas-1.0             | 6 KB      | ############################################################################ | 100%
libtiff-4.1.0        | 1.1 MB    | ############################################################################ | 100%
ninja-1.10.1         | 275 KB    | ############################################################################ | 100%
numpy-base-1.19.2    | 4.8 MB    | ############################################################################ | 100%
mkl_fft-1.2.0        | 135 KB    | ############################################################################ | 100%
mkl-service-2.3.0    | 200 KB    | ############################################################################ | 100%
numpy-1.19.2         | 21 KB     | ############################################################################ | 100%
tk-8.6.10            | 3.2 MB    | ############################################################################ | 100%
libpng-1.6.37        | 598 KB    | ############################################################################ | 100%
mkl-2020.2           | 170.7 MB  | ############################################################################ | 100%
zstd-1.4.5           | 837 KB    | ############################################################################ | 100%
mkl_random-1.1.1     | 272 KB    | ############################################################################ | 100%
ca-certificates-2020 | 159 KB    | ############################################################################ | 100%
lz4-c-1.9.2          | 121 KB    | ############################################################################ | 100%
intel-openmp-2020.2  | 2.0 MB    | ############################################################################ | 100%
cffi-1.14.3          | 226 KB    | ############################################################################ | 100%
olefile-0.46         | 49 KB     | ############################################################################ | 100%
jpeg-9b              | 313 KB    | ############################################################################ | 100%
pycparser-2.20       | 94 KB     | ############################################################################ | 100%
openssl-1.1.1h       | 5.8 MB    | ############################################################################ | 100%
freetype-2.10.4      | 490 KB    | ############################################################################ | 100%
pillow-8.0.1         | 736 KB    | ############################################################################ | 100%
pytorch-1.1.0        | 427.2 MB  | ###########################################################################8 | 100% WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:CodingSoftwareAnaconda3pkgspytorch-1.1.0-py3.7_cuda90_cudnn7_1Libsite-packagestorchincludepybind11chrono.h.  Please remove this file manually (you may need to reboot to free file handles)
WARNING conda.gateways.disk.delete:unlink_or_rename_to_trash(140): Could not remove or rename D:CodingSoftwareAnaconda3pkgspytorch-1.1.0-py3.7_cuda90_cudnn7_1Libsite-packagestorchincludepybind11chrono.h.  Please remove this file manually (you may need to reboot to free file handles)
pytorch-1.1.0        | 427.2 MB  | ############################################################################ | 100%
torchvision-0.3.0    | 2.3 MB    | ############################################################################ | 100%
cudatoolkit-9.0      | 339.8 MB  | ############################################################################ | 100%
xz-5.2.5             | 333 KB    | ############################################################################ | 100%
zlib-1.2.11          | 132 KB    | ############################################################################ | 100%InvalidArchiveError('Error with archive D:\CodingSoftware\Anaconda3\pkgs\pytorch-1.1.0-py3.7_cuda90_cudnn7_1.tar.bz2.  You probably need to delete and re-download or re-create this file.  Message from libarchive was:nnCould not unlink')

仔细看一下出错信息:

InvalidArchiveError('Error with archive D:\CodingSoftware\Anaconda3\pkgs\pytorch-1.1.0-py3.7_cuda90_cudnn7_1.tar.bz2.  You probably need to delete and re-download or re-create this file.  Message from libarchive was:nnCould not unlink')

将指定的文件删除后,再次安装。成功。

本文发布于:2024-02-02 18:45:35,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170687073345723.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23