Every now and then you might find yourself having to reinstall ComfyUI. Lately my test environment of ComfyUI has been a bit wonky so I’ve decided to do a clean installation of it. This guide will show you every step of the way from installing ComfyUI to downgrading PyTorch, installing Triton and Sage Attention as well as a mishap with X-formers and how to solve that.
Note! If you have an NVIDIA Blackwell GPU (50xx series) there’s a newer guide available for you here: How to Upgrade ComfyUI to CUDA 13.1 (Blackwell Guide)
If you prefer video tutorials over text, you can watch my youtube video instead, or as a compliment to this text guide.
Uninstalling
Since this is my test environment, I don’t actually have any models in this folder. All models are in my main ComfortUI folder and I’m using system links to access them from my test environment. That means that I can just delete the whole ComfortUI folder. If you are reinstalling a ComfortUI where you have your models located, I would suggest that you move them elsewhere during the installation so you don’t have to re-download them all later. Just move the entire model folder to somewhere safe.
Starting fresh
Independent research like this is self-funded. If this guide saved you hours of troubleshooting, consider fueling the lab.
Support the Project
Most of the time installing ComfyUI is pretty straightforward and doesn’t cause too much headache. We will be installing the portable version here today. There is a web app version as well, but I’ve tried it and I didn’t like it. First you need to go to ComfyUI at Github, and once there, scroll down a bit until you get to the part that says Windows Portable. Click on the direct link to download in order to download a compressed folder containing everything you need.
The file is a bit over 1GB. Once the file is downloaded, open it and select everything inside. Then drag all of it to an empty folder where you want your installation to be located. When you have moved all the files to the new folder, the installation is basically done.
The downgrade

The current ComfyUI installation comes with Torch 2.9 for CUDA 13.0 pre-installed. I don’t want this version because it’s very new and the newest Torch and CUDA often causes dependency issues. So I’m going to downgrade to a previous version that I know is stable, which in my case is Torch 2.8 for CUDA 12.8.
Go to pytorch.org and scroll down to version 2.8.0. For this installation we are using Pytorch 2.8 with CUDA 12.8.

To install this, navigate to your ComfyUI installation folder, where you can see the view below (maybly the python_embeded folder).

Right-click inside that folder and open a command window, and use the following command to uninstall your existing pytorch version:

python_embeded/python.exe -m pip uninstall torch torchvision torchaudio
Then, in the same command window use the following command to install the correct version:
python_embeded/python.exe -m pip install torch==2.8.0 torchvision==0.23.0 torchaudio==2.8.0 --index-url https://download.pytorch.org/whl/cu128
Speed boost

For this next step we are going to install Triton and Sage Attention in that order, and you can find a written guide for that here: Triton and Sageattention
Since our PyTorch version is higher than 2.7, we use the following command to install Triton:
python_embeded/python.exe -m pip install -U "triton-windows<3.3"
Next we are installing SageAttention and if you are reading my text guide you can just scroll down a little bit to find the instructions. To install the correct version of Sage Attention we use the following command:
python_embeded/python.exe -m pip install sageattention==1.0.6
Independent research like this is self-funded. If this guide saved you hours of troubleshooting, consider fueling the lab.
Support the ProjectX-formers

Next we will install x-formers, so we need to head to their github page for the installation command.
Important lesson: Do not install the latest x-formers. Doing that would automatically upgrade your torch to version 2.9, and it will be incompatible with your installed torchvision and torchaudio.
Instead you need to look at previous releases and find a version suitable for Pytorch 2.8. And that would be version 0.0.32.post1. The command for installing the correct version of xformers is the following:
python_embeded/python.exe -m pip install xformers==0.0.32.post1
ComfyUI Manager

By installing ComfyUI manager, you are doing your future self a huge favour. To install this you need to navigate to your custom nodes folder, located at ComfyUI/custom_nodes. Once there, right click inside that folder and open a command window. In this new command window use the folloing command:
git clone https://github.com/Comfy-Org/ComfyUI-Manager
This will clone the repository to your custom nodes folder. Then, in the same command window use the following code, to move into the managers folder:
cd ComfyUI-Manager
And lastly, we have to install the requirements for ComfyUI manager, which is done by using this command (still in the same command window):
../../python_embeded/python.exe -m pip install -r requirements.txt

If you liked this guide and want to got more of these, as well as other useful tips directly in your inbox, you should sign up for my newsletter.
