码迷,mamicode.com
首页 > 其他好文 > 详细

安装PyTorch-Geometric包

时间:2019-05-27 13:14:13      阅读:787      评论:0      收藏:0      [点我收藏+]

标签:pytorch   www   required   _MSC_VER   var   install   windows   download   print   

pip install torch-scatter
# 报错
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

解决方法Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)

也可以直接安装whl包:https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

CUDA9.1 Visual Studio Integration 安装失败问题,如何解决? - 徐遥的回答 - 知乎
https://www.zhihu.com/question/276491276/answer/394778358 (有VS tools的早期版本)

pip install torch-scatter
# 报错
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\crt/host_config.h(133): fatal error C1189: #error:  -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported!
    scatter_kernel.cu
    error: command 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\bin\\nvcc.exe' failed with exit status 2

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\crt\host_config.h文件中有下面的代码筛选:

#if _MSC_VER < 1600 || _MSC_VER > 1911

因为安装的Visual Studio是2019的

// test.cpp
#include <stdio.h>
#include <Windows.h>
int main(){
    printf("%d",_MSC_VER);
    return 0;
}

打开x86_x64 Cross Tools Command Prompt for VS 2019

cl test.cpp # 编译
test.exe # 输出版本号1921

修改cuda配置的VS build tools信息好像不管用,使用下面的方法:

1 卸载VS 2019 Build tools

2 安装VS 2015 Build tools,该工具的_MSC_VER=1900是MS VC++ 14.0

参考visual c++ build tools的安装与使用中的下载地址

https://download.microsoft.com/download/5/f/7/5f7acaeb-8363-451f-9425-68a90f98b238/visualcppbuildtools_full.exe

$ pip install --verbose --no-cache-dir torch-scatter
$ pip install --verbose --no-cache-dir torch-sparse
$ pip install --verbose --no-cache-dir torch-cluster
$ pip install --verbose --no-cache-dir torch-spline-conv (optional)
$ pip install torch-geometric

安装成功!

安装PyTorch-Geometric包

标签:pytorch   www   required   _MSC_VER   var   install   windows   download   print   

原文地址:https://www.cnblogs.com/ZeroTensor/p/10930031.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!