安装PyTorch-Geometric包
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的安装与使用中的下载地址
$ 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
如果遇到下面问题:
c:\programdata\anaconda3\include\pyconfig.h(222): fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory
是因为你没有安装win10 sdk,参考https://www.jianshu.com/p/a7963ebecbe4
注意pytorch的版本要1.1或者以上,否则torch-scatter会出现安装错误
安装成功!
posted on 2019-05-27 12:23 Frank_Allen 阅读(7352) 评论(1) 编辑 收藏 举报