jupyter笔记本:导入错误:dll负载失败(但在.py上起作用)没有anaconda
我试图在Windows10上的Jupyter笔记本中使用Cupy,并收到此错误:
---> from cupy_backends.cuda.libs import nvrtc
ImportError: DLL load failed while importing nvrtc: The specified procedure could not be found.
这是由import cupy
触发的。
我知道有很多关于类似问题的线程(jupyter在Windows下找不到的DLL),但是他们中的每个人都依靠Conda,我不再使用了。
我检查了os.environ ['cuda_path']
,设置为c:\\ program Files \\ nvidia gpu Computing Toolkit Toolkit \\ cuda \\ cuda \\ v11.6
and Code> and Code>和是正确的道路。
另外,os.environ ['path']
包含c:\\ program Files \\ nvidia gpu gpu Computing工具包\\ cuda \\ v11.6 \\ bin
是DLL所在的位置。
我通过运行pip install -U笔记本
修复了一次,然后在重新启动jupyter后再次失败。运行相同的命令(即使使用- Force-Reinstall
)也无法再次产生相同的效果。
使用壳或常规的python iDE时,我没有问题。我可以使用解决方案,例如为我自己执行基于CUPY的命令,但这会违反使用笔记本的教学法和示例,这是我对笔记本电脑的主要用途。
有人会解决不依赖康达的解决方案吗?
I was trying to use CuPy inside a Jupyter Notebook on Windows10 and got this error :
---> from cupy_backends.cuda.libs import nvrtc
ImportError: DLL load failed while importing nvrtc: The specified procedure could not be found.
This is triggered by import cupy
.
I know there is a bunch of threads about similar issues (DLLs not found by Jupyter under Windows), but everyone of them relies on conda, that I'm not using anymore.
I checked os.environ['CUDA_PATH']
, which is set to C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.6
and is the right path.
Also, os.environ['PATH']
contains C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v11.6\\bin
which is where the DLL is located.
I fixed it once by running pip install -U notebook
, then it started failing again after restarting Jupyter. Running the same command (even with --force-reinstall
) could not produce the same effect again.
I have no problems with CuPy when using a shell or a regular Python IDE. I could use workarounds like executing CuPy based commands outside Jupyter for myself, but that would go against using notebooks for pedagogy and examples, which is my major use of notebooks.
Would anyone have a fix for that not relying on conda ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
出现错误是因为我在Cupy之前进口了Pytorch。
解决方案是在火炬之前进口杯子。
The error was showing up because I was importing PyTorch before CuPy.
Solution was to import cupy before torch.