python - CUDA版本的包没有导入?
问题描述
首先,我安装了 torch 1.1.0,然后安装了它的依赖项。所以,我可以导入 torch_scatter 1.2.0 但是在导入 torch_scatter.scatter_cuda 时出现此错误:
import torch_scatter.scatter_cuda
ModuleNotFoundError: No module named 'torch_scatter.scatter_cuda'
我安装了 Cuda v10 并且有一个 GPU。这段代码的所有要求都是通过 pip 在我的虚拟环境中一次性安装的。
解决方案
As pointed out by phd - it looks like the setup.py file of pytorch_scatter checks for and uses an available cuda installation automatically.
Also in the version you are using as seen here:
...
if CUDA_HOME is not None:
ext_modules += [
CUDAExtension('torch_scatter.scatter_cuda',
['cuda/scatter.cpp', 'cuda/scatter_kernel.cu'])
]
...
Might be a question of whether CUDA_HOME
is available.
Installing from source might give you more information as suggested here.
推荐阅读
- javascript - 如何通过浏览器脚本激活输入框(提供小提琴)
- mysql - 迁移中止外键约束
- splunk - 尝试基于一列执行数学计算
- javascript - 无法追踪可能的导入/导出错误 - React/ES6 模块
- python - mariadb 游标参数标记问题
- c# - 当我尝试使用 C# 保存图像文件时如何修复“UnauthorizedAccessException”?
- android - 如何禁用我的地理围栏广播接收器?
- typescript - 从联合类型创建的打字稿合并映射类型
- c# - ASP.NET Core 2.2,无法确定实体框架中导航属性表示的关系
- angular - 在 ngx-chart pie 中使用 labelFormatting