首页 > 解决方案 > 原始错误:导入运行时时 DLL 加载失败:

问题描述

我正在使用一个库(石榴),我希望它在 GPU 中运行,这需要安装 Cupy-CUDA。我已经使用 install cupy-cuda111 安装了它(根据这个文档,因为我的 CUDA 版本是 11.1)。

我在 " import cupy" 行收到此错误,我不知道如何解决。

Traceback (most recent call last):
  File "C:\Users\andrea\.virtualenvs\workspace-ee5hg7DR\lib\site-packages\cupy\__init__.py", line 16, in <module>
    from cupy import _core  # NOQA
  File "C:\Users\andrea\.virtualenvs\workspace-ee5hg7DR\lib\site-packages\cupy\_core\__init__.py", line 1, in <module>
    from cupy._core import core  # NOQA
  File "cupy\_core\core.pyx", line 1, in init cupy._core.core
  File "C:\Users\andrea\.virtualenvs\workspace-ee5hg7DR\lib\site-packages\cupy\cuda\__init__.py", line 8, in <module>
    from cupy.cuda import compiler  # NOQA
  File "C:\Users\andrea\.virtualenvs\workspace-ee5hg7DR\lib\site-packages\cupy\cuda\compiler.py", line 11, in <module>
    from cupy.cuda import device
  File "cupy\cuda\device.pyx", line 1, in init cupy.cuda.device
ImportError: DLL load failed while importing runtime: No se puede encontrar el módulo especificado.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\andrea\Desktop\workspace\train11.py", line 16, in <module>
    import cupy as cp
  File "C:\Users\andrea\.virtualenvs\workspace-ee5hg7DR\lib\site-packages\cupy\__init__.py", line 37, in <module>
    raise ImportError(_msg) from e
ImportError: CuPy is not correctly installed.

If you are using wheel distribution (cupy-cudaXX), make sure that the version of CuPy you installed matches with the version of CUDA on your host.
Also, confirm that only one CuPy package is installed:
  $ pip freeze

If you are building CuPy from source, please check your environment, uninstall CuPy and reinstall it with:
  $ pip install cupy --no-cache-dir -vvvv

Check the Installation Guide for details:
  https://docs.cupy.dev/en/latest/install.html

original error: DLL load failed while importing runtime: No se puede encontrar el módulo especificado.

那里说 Cupy 没有正确安装,但是我卸载并安装了两次,错误仍然存​​在。

蟒蛇= 3.9.7

CUDA = 11.1

Linux(使用 pipenv)

标签: pythondllruntime-errorcupy

解决方案


推荐阅读