即将开始学习GNN,当重新安装完pytorch环境后,进行torch-geometric安装完之后,运行以下代码
出现 AttributeError: module torch has no attribute sparse_csc 报错情况,通过查询各种资料,没有找到解决办法,当查看torch手册时发现,是torch-geometric版本不对应问题
通过 conda activate XXX 进入创建的虚拟环境
使用 pip show torch-geometric 查看torch-geometric版本号,发现自己安装的是最新的版本2.3.1
而该版本对应的torch应该在2.0以上,故需要降低torch-geometric的版本
首先,使用 pip uninstall torch-geometric 进行卸载已有版本的torch-geometric
然后,使用pip install torch-geometric==2.1.0 进行安装2.1.0 更低版本的torch-geometric
之后在运行之前代码,便可以得到运行结果。