ComfyUI is a node-based user interface for Stable Diffusion, a popular artificial intelligence model for generating images from text prompts. ComfyUI is very configurable and allows you to create and share workflows easily and also very easy to install ComfyUI.
In this guide you are going to learn how to install ComfyUI on Ubuntu 22.04. This setup is tested on a server running on Google cloud with Tesla T4 GPU and Nvidia.
Prerequisites
- Basic knowledge on using Linux Terminal commands.
- Make sure you have your Graphic card installed and configured with Nvidia, Cuda, cuDNN, Python.
Initial Server setup
Updated server packages to the latest version available.
sudo apt update
sudo apt upgrade -y
Configure Virtual Environment
Once you have all the setups completed in the prerequisites section you can proceed below to configure Python virtual environment.
sudo apt install python3-venv
Once this module is installed you can proceed to create your virtual environment.
Navigate to the directory where you want to install ComfyUI and execute the below command.
python -m venv comfyui-env
This command creates a directory named comfyui-env
directory with Pip package manager and the Python library.
Now you need to activate your virtual environment.
source comfyui-env/bin/activate
You will see something similar to the one below.
(comfyui-env) $
Now you can proceed to the next step to install PyTorch.
Install PyTorch for Nvidia
Execute the below command to install the latest version of stable PyTorch.
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu121
If you get the “Torch not compiled with CUDA enabled
” error, uninstall torch with:
pip uninstall torch
Reinstall torch again using the above command.
Download ComfyUI
Once you have everything in place you can continue to pull the repository from the official ComfyUI repository using the git clone
command.
git clone https://github.com/comfyanonymous/ComfyUI.git
Navigate inside the directory.
cd ComfyUI
Install ComfyUI
Install the dependencies inside the ComfyUI folder by executing the below command.
pip install -r requirements.txt
Now you should have everything installed and can proceed to running ComfyUI.
Run ComfyUI
Start ComfyUI using the below command.
python main.py
You will see the URL with port on which ComfyUI is running. Copy the URL to your browser. You will see your dashboard similar to the one below.
Conclusion
Now you have learned how to install ComfyUI on Ubuntu 22.04.
Thanks for your time. If you face any problem or any feedback, please leave a comment below.
Leave your Reply