python

关注公众号 jb51net

关闭
首页 > 脚本专栏 > python > pytorch找不到shm.dll模块

解决pytorch找不到shm.dll模块的问题

作者:rotciv

本文主要介绍了解决pytorch找不到shm.dll模块的问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

找不到指定的模块 shm.dll

启动ComfyUI_windows_portable时报错,提示找不到指定的模块,…\torch\lib\shm.dll" or one of its dependencies. 但是在对应的python sitepackage中shm是存在的。

import torch

报错 ,说明pytorch的依赖关系有问题了。由于ComfyUI_windows_portable使用了embeded python,卸载现有的torch

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip uninstall torch

过程显示,torch安装了torch-2.3.1+cu121。
重新安装torch

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install torch==2.3.1

安装成功,重新启动ComfyUI,提示AttributeError: module ‘torch’ has no attribute ‘Tensor’,报错退出。于是尝试升级torch

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install --upgrade torch

出现…requires torch 2.3.1+cu121, but you have torch 2.3.1 which is incompatible…,显然这个torch和torch-2.3.1+cu121是不兼容的。卸载torch 2.3.1,重新安装

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install torch==2.3.1+cu121 -f https://download.pytorch.org/whl/torch_stable.html

开始下载https://download.pytorch.org/whl/cu121/torch-2.3.1%2Bcu121-cp311-cp311-win_amd64.whl,有2.4GB。可以自行下载torch 2.3.1+cu121,注意选择正确的操作系统、CPU架构和python版本的whl文件,可以使用下载工具,提高下载速度。
离线安装whl

.\python_embeded\python.exe python_embeded\Lib\site-packages\pip install torch-2.3.1+cu121-cp311-cp311-win_amd64.whl

显示安装“success”,重启ComfyUI,成功!

到此这篇关于解决pytorch找不到shm.dll模块的问题的文章就介绍到这了,更多相关pytorch找不到shm.dll模块内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

您可能感兴趣的文章:
阅读全文