StabilityMatrix icon indicating copy to clipboard operation
StabilityMatrix copied to clipboard

🚀 Fixing Fooocus on Windows with NVIDIA 50xx and CUDA 12.8 (Driver 572.42 Game Ready)

Open KoholSzkodzi opened this issue 10 months ago • 7 comments

Proposal

⚙️ Solution for Fooocus on Windows with NVIDIA 50xx Series (Tested on 5090 with Driver 572.42 Game Ready)

This guide explains how to fix compatibility issues for Stability Matrix with Fooocus on Windows using an NVIDIA 50xx series GPU (like the 5090).


🔗 Prerequisites: CUDA 12.8

You need CUDA 12.8 installed on your system for this to work.

⚠️ Important Note:

During the installation:

  • Select “Custom Install”
  • Uncheck the Graphics Drivers (The drivers included may be outdated, and using the latest Game Ready driver 572.42 is recommended).

Solution Overview

To get Fooocus working with your NVIDIA 5090, you’ll need to install a custom version of PyTorch and Torchvision that supports CUDA 12.8. Here’s how to do it:


1. 🔗 Download Compatible PyTorch and Torchvision


2. 📂 Locate the Virtual Environment

  • Find the virtual environment used by Fooocus. It’s usually here:
    C:\Users\*your_username*\AppData\Roaming\StabilityMatrix\Packages\Fooocus\venv\scripts
    
  • Navigate to this folder using File Explorer.

3. 💻 Open Command Prompt in the Correct Directory

  • In File Explorer, click on the path bar (where the folder path is displayed).
  • Type cmd and press Enter. This opens Command Prompt directly in that folder.

4. ✅ Activate the Virtual Environment

In the Command Prompt, type:

activate

You should see something like (venv) at the start of the command line.


5. 📥 Install PyTorch and Torchvision

  • Go to the folder where you downloaded the .whl files for PyTorch and Torchvision.
  • Right-click on the PyTorch file and select Copy as path.
  • In the Command Prompt, type:
    pip install "paste your file path here"
    
  • If it says a version is already installed, use:
    pip install "paste your file path here" --force-reinstall
    
  • Repeat for the Torchvision file:
    pip install "torchvision file path"
    
    Or, if needed:
    pip install "torchvision file path" --force-reinstall
    

6. 🚫 Deactivate the Virtual Environment

Once the installation is complete, type:

deactivate

This exits the virtual environment.


Done!

Your Fooocus setup should now work without errors on your NVIDIA 5090 GPU with driver 572.42 Game Ready.

KoholSzkodzi avatar Feb 17 '25 12:02 KoholSzkodzi

I assume I can just do the same for ComfyUI?

khoidang avatar Feb 18 '25 20:02 khoidang

Yes, this should work for most webUIs for 5000-series cards until there's an official release of torch with cuda 12.8.

However, you can save yourself some headache by using our built-in Python Packages dialog (in the 3-dots menu on the Packages page) to skip all the manual venv activation stuff in steps 2-4 and just go straight to step 5 like so:

Image

mohnjiles avatar Feb 18 '25 21:02 mohnjiles

After each ComfyUI update all torch\torchvision goes back to previous versions for me. Is there a way to keep updated versions?

E2GO avatar Mar 18 '25 19:03 E2GO

In the 3-dots -> Python Dependencies Override menu you can pin specific versions so they don't change on update like so:

Image

mohnjiles avatar Mar 18 '25 19:03 mohnjiles

There could be a problem with installing PyTorch and Torchvision due to a circular dependency: an updated PyTorch won't install with an old version of Torchvision, and an updated Torchvision won't install with an old version of PyTorch. To bypass this issue, you can use the installation flag --no-deps to skip compatibility checks.

So initial commands

pip install "paste your file path here" or pip install "paste your file path here" --force-reinstall

will looks like

pip install "paste your file path here" --no-deps or pip install "paste your file path here" --force-reinstall --no-deps

MadMan2k avatar Mar 29 '25 13:03 MadMan2k

To be 100% clear, here's step by step instructions on how to support 5000 series on Stability Matrix (any package):

  1. Install ComfyUI (if already installed, skip)
  2. Click the 3 dots above the ComfyUI
  3. Click Python Packages
  4. Find torch, torchvision, and torch audio. Select each and hit "-" to uninstall.
  5. Click the "+" and enter this in the install prompt (no quotes): "--pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128"
  6. After it's done hit close.
  7. Click the 3 dots and click Python Dependency Override
  8. Set up 3 overrides: torch, torchvision, and torchaudio. In the Version enter (no quotes): "https://download.pytorch.org/whl/nightly/cu128"
  9. Hit save.

jnadke avatar Apr 19 '25 01:04 jnadke

Im following the steps below: i don have these subfolders StabilityMatrix\Packages\Fooocus\venv\scripts in this location. 3. 📂 Locate the Virtual Environment Find the virtual environment used by Fooocus. It’s usually here:

C:\Users\*your_username*\AppData\Roaming\StabilityMatrix\Packages\Fooocus\venv\scripts

Navigate to this folder using File Explorer.

Imwalrus38 avatar Jul 18 '25 02:07 Imwalrus38