我是靠谱客的博主 跳跃背包,最近开发中收集的这篇文章主要介绍ModuleNotFoundError: No module named 'torch_sparse.unique_cuda',觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

原因:pip install torch_sparse 时,编译器没有找到 cuda 或 cudann 的环境变量,只生成了 cpu 版本的 torch_sparse,而省略了和cuda相关的模块。

解决方案:

手动安装 cuda,cudann

参考教程:

https://blog.csdn.net/Mind_programmonkey/article/details/99688839#commentBox

需要注意,cuda,cudann 和 visual studio 版本之间的对应。比如:cuda 10.0, cudann 7.6,vs 2017
在这里插入图片描述

重新安装 torch_sparse

(pytorch) C:UsersMONKEYDesktop>pip uninstall torch-sparse
Uninstalling torch-sparse-0.4.0:
  Would remove:
    d:miniconda3envspytorchlibsite-packagestest*
    d:miniconda3envspytorchlibsite-packagestorch_sparse-0.4.0.dist-info*
    d:miniconda3envspytorchlibsite-packagestorch_sparse*
  Would not remove (might be manually added):
    d:miniconda3envspytorchlibsite-packagestesttest_backward.py
    d:miniconda3envspytorchlibsite-packagestesttest_forward.py
    d:miniconda3envspytorchlibsite-packagestesttest_max_min.py
    d:miniconda3envspytorchlibsite-packagestesttest_multi_gpu.py
    d:miniconda3envspytorchlibsite-packagestesttest_std.py
Proceed (y/n)? y
  Successfully uninstalled torch-sparse-0.4.0
(pytorch) C:UsersMONKEYDesktop>pip install torch-sparse
Collecting torch-sparse
  Using cached https://files.pythonhosted.org/packages/b0/0a/2ff678e0d04e524dd2cf990a6202ced8c0ffe3fe6b08e02f25cc9fd27da0/torch_sparse-0.4.0.tar.gz
Requirement already satisfied: scipy in d:miniconda3envspytorchlibsite-packages (from torch-sparse) (1.3.1)
Requirement already satisfied: numpy>=1.13.3 in d:miniconda3envspytorchlibsite-packages (from scipy->torch-sparse) (1.16.5)
Building wheels for collected packages: torch-sparse
  Building wheel for torch-sparse (setup.py) ... done
  Created wheel for torch-sparse: filename=torch_sparse-0.4.0-cp36-cp36m-win_amd64.whl size=285224 sha256=7a88deb0de81c8b0095ac5362aaabe291737e8d3aa587b5b0e6309a706be092b
  Stored in directory: C:UsersMONKEYAppDataLocalpipCachewheels9d83a38ea460df5586a075b877fe089619e5238487712a0645940bd
Successfully built torch-sparse
Installing collected packages: torch-sparse
Successfully installed torch-sparse-0.4.0

最后

以上就是跳跃背包为你收集整理的ModuleNotFoundError: No module named 'torch_sparse.unique_cuda'的全部内容,希望文章能够帮你解决ModuleNotFoundError: No module named 'torch_sparse.unique_cuda'所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(37)

评论列表共有 0 条评论

立即
投稿
返回
顶部