1. make new python venv
python -m venv newpythonvenv --upgrade-deps
use dir and cd in windows cmd (or use gui) to navigate to Scripts/ and activate the venv
cd back to main comfyui folder where requirements.txt is
2. python -m pip install -r requirements.txt
(the python -m is important; it uses the venv python and packages instead of the system's)
if there's no pip yet, run python ensure pip --upgrade
3. with nvidia cuda installed on system (for faster speeds), install pytorch (while venv is activated)
pip uninstall torch torchvision torchaudio (this uninstalls the non-gpu versions of pytorch)
then
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124
or
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
(check https://pytorch.org/get-started/locally/ for the version)
4. copy and paste these lines into the starting bat file to use your venv:
@echo off
pushd "%~dp0\ComfyUI"
call "comfyvenv\Scripts\activate.bat"
python -s main.py --windows-standalone-build
popd
pause
then save the .bat file
(Optional) comfyui manager install:
go to ComfyUI/custom_nodes dir in terminal (cmd)
git clone https://github.com/ltdrdata/ComfyUI-Manager comfyui-manager
5. click the .bat file to start comfyui
Check cuda version on windows:
nvcc --version
or
nvidia-smi