Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Win11+Visual Studio 2022,install successfully. #1809

Open
aswordok opened this issue Jun 18, 2024 · 1 comment
Open

Win11+Visual Studio 2022,install successfully. #1809

aswordok opened this issue Jun 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@aswordok
Copy link

aswordok commented Jun 18, 2024

win11
Python 3.11.8
CUDA Ver: 11.8
torch Ver: 2.3.0+cu118
torchvision Ver: 0.18.0+cu118
torchaudio Ver: 2.3.0+cu118
cuDNN Ver: 8700
Visual Studio 2022 安装 使用 C++ 桌面开发

参考:#835 (comment)

cd D:+AI\ComfyUI\ComfyUI_windows_portable\python_embeded
git clone https://github.com/NVIDIA/apex
cd apex
git checkout 2ec84eb
..\python -m pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .
Successfully installed apex-0.1
Error:
raw_output = subprocess.check_output([cuda_dir + "/bin/nvcc", "-V"], universal_newlines=True)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。
Solved:
这里需要注意的是,在安装pytorch时会自动装上CUDA和cuDNN包并且会劫持调用,我们仍要在系统中安装上相同版本的CUDA和cuDNN。
set | findstr CUDA
注意CUDA_DIR要大写:set当前窗生效,setx写入环境变量,重新开窗仍有效
set CUDA_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
setx /m CUDA_DIR "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
验证:
..\python.exe -m pip list | findstr apex
..\python -c "from apex import amp"
Error:
No module named 'torch._six'
Solved:
cmd运行:(只能在同盘符中运行)(windows下如果安装了git是有sed这个命令的,把 C:\Program Files\Git\usr\bin 添加到系统变量Path中)
sed -i 's/from torch._six import container_abcs/import collections.abc as container_abcs/' "D:+AI\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\apex\amp_amp_state.py"
sed -i 's/from torch._six import string_classes/string_classes = str/' "D:+AI\ComfyUI\ComfyUI_windows_portable\python_embeded\Lib\site-packages\apex\amp_initialize.py"
再次验证:
..\python -c "import apex;import importlib;global fused_layer_norm_cuda;fused_layer_norm_cuda = importlib.import_module('fused_layer_norm_cuda')"
这是从comfyUI中的apex提炼出来的测试代码,没有错误提示则是成功。
Error:No module named 'fused_layer_norm_cuda'
Solved: 原因是安装apex时没有安装cuda版本,--cuda_ext 安装时必须带上。
经测试 comfyUI 运行正常。

@aswordok aswordok added the bug Something isn't working label Jun 18, 2024
@doctorpangloss
Copy link

#1792

you have to follow my instructions from here, and also add fused layer norm to your build options. You will not succeed in using those nodes that say they are for Linux in Windows right now. Use WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants