GNN学习笔记(一):PyTorch Geometric 环境搭建(win10_CPU_jupyter/ Linux_GPU_VSCode远程)

1 创建python虚拟环境

conda create -n env python=3.8

conda info --envs

conda activate env

2 安装pytorch

官方文档:PyTorchGNN学习笔记(一):PyTorch Geometric 环境搭建(win10_CPU_jupyter/ Linux_GPU_VSCode远程)_第1张图片

 清华源:

-i https://pypi.tuna.tsinghua.edu.cn/simple some-package
pip3 install torch torchvision torchaudio -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

我的版本:torch-1.11.0-cp38-cp38-win_amd64.whl

Linux + GPU:

查看cuda版本:
nvcc -V


>>>import torch 

查看torch版本:
>>>print(torch.__version__)

测试pytorch的cuda是否可用
>>>print(torch.cuda.is_available())

3 安装PyG (PyTorch Geometric)

官方文档: PyG Documentation — pytorch_geometric 2.0.5 documentation

GNN学习笔记(一):PyTorch Geometric 环境搭建(win10_CPU_jupyter/ Linux_GPU_VSCode远程)_第2张图片

pip install torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.11.0+cpu.html -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

4 jupyter 指定虚拟环境

  1. 进入虚拟环境:

    conda activate env
  2. pip install ipykernel -i https://pypi.tuna.tsinghua.edu.cn/simple some-package #不用清华源出现httperror
  3. 向jupyter中添加虚拟环境,命名为env:

    python -m ipykernel install --name env
  4. jupyter notebook进入jupyter;jupyter页面 kernel-->change kernel 选择env

5 VSCode远程连接

1. 配置文件

GNN学习笔记(一):PyTorch Geometric 环境搭建(win10_CPU_jupyter/ Linux_GPU_VSCode远程)_第3张图片 config文件写入

Host host1
    HostName xxx.xxx.xxx.xxx 
    Port xxxx
    User name

 2. 连接GNN学习笔记(一):PyTorch Geometric 环境搭建(win10_CPU_jupyter/ Linux_GPU_VSCode远程)_第4张图片

 

你可能感兴趣的:(GNN学习笔记,pytorch)