1. 程式人生 > 其它 >Linux本地安裝包安裝PyG

Linux本地安裝包安裝PyG

Linux本地安裝包安裝PyG

基礎環境

Linux系統
python 3.6.13
torch 1.5.0
cuda 10.1
cudnn 7.6.3

確保安裝的torch和cuda版本配套,可在torch下載官網檢視,注意系統不同命令也不同
檢查cuda版本命令:

nvcc -version
>>nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105

python -c "import torch; print(torch.version.cuda)"
>>10.1

安裝包下載

pytorch-geometric官網地址 對應PyTorch1.5,下載時根據torch版本選擇,如我的python3.6,torch1.5.0,cuda10.1,linux系統對應的whl在這裡插入圖片描述在這裡插入圖片描述在這裡插入圖片描述

其它版本的torch只需要將連結中的1.5換成對應版本,如1.4
https://pytorch-geometric.com/whl/torch-1.4.0.html

安裝

進入存放whl檔案的資料夾,pip安裝命令:

pip install torch_scatter-latest+cu101-cp36-cp36m-linux_x86_64.whl
pip install torch_sparse-latest+cu101-cp36-cp36m-linux_x86_64.whl
pip install torch_cluster-latest+cu101-cp36-cp36m-linux_x86_64.whl
pip install torch_spline_conv-latest+cu101-cp36-cp36m-linux_x86_64.whl
pip install pytorch_geometric

檢查安裝結果


>>import torch
>>import torch_geometirc

至此完成,之所以選擇本地安裝是因為直接使用命令安裝出現錯誤,具體原因沒有了解,之後有機會補上。

ERROR: Exception: Traceback (most recent call last): File
“/home/ssr/miniconda3/envs/py36tc/lib/python3.6/site-packages/pip/_vendor/resolvelib/resolvers.py”,
line 171, in _merge_into_criterion
crit = self.state.criteria[name] KeyError: ‘torch-scatter’

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File
“/home/ssr/miniconda3/envs/py36tc/lib/python3.6/site-packages/pip/_internal/cli/base_command.py”,
line 189, in _main
status = self.run(options, args) ’