ComfyUI V0.3.14 will allow you to design and execute advanced stable diffusion pipelines using graphical/node/flowchart-based interfaces. The new interface has added multi-language support, so you can no longer install any Chinese packages. Run faster and quickly generate the required images. Installation is easier and more convenient.
The following is the server configuration we installed and configured. To put it in a long story, we will first do the environment configuration and installation.
Machine configuration:
50G memory (below 50G may report an error, the larger the memory, the better)
P40 GPU card is 24GB per piece (recommended to use graphics cards with RTX3090/24G or above), because P40 is indeed a bit slow.
Debian12.9, python3.10, the reason why debian is used is because it occupies a smaller hard drive and has higher running speed than ubuntu, and it seems to be less viruses against it.
Boot disk: 100G. Of course, this capacity is far from enough to place the video model. We can add a 2TB hard disk separately, which is specially used to place the model.
1: Install the GPU driver
Nvidia GPU driver installation
#install the compilation environment apt install gcc g++ apt install make #Installing dependencies apt install pkg-config apt install linux-headers* #Close the control of nouveau $sudo bash -c "echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.conf" $sudo bash -c "echo options nouveau modeset=0 >> /etc/modprobe.d/blacklist-nvidia-nouveau.conf" #Note that you need to restart the server reboot #Delete the old driver apt purge nvidia* #Download nvidia's new driver file, the current driver file, and there may be updates in the future. wget https://us.download.nvidia.cn/tesla/565.57.01/NVIDIA-Linux-x86_64-565.57.01.run #Installing the driver chmod +x NVIDIA-Linux-x86_64-565.57.01.run ./NVIDIA-Linux-x86_64-565.57.01.run #Test output nvidia-smi
2. Install cuda
1. Download cuda:
#Download cuda wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run #Run chmod +x cuda_12.4.0_550.54.14_linux.run ./cuda_12.4.0_550.54.14_linux.run
2. Modify environment variables
vim ~/.bashrc
Add the following content, please determine the path according to the actual situation, such as cuda-12.5, and the corresponding changes should be made below.
CUDA_HOME=/usr/local/cuda-12.5 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.5/lib64 PATH="$CUDA_HOME/bin:$PATH"
3. Make it effective
source ~/.bashrc
4. Install cudnn
Download address: cuDNN Archive | NVIDIA Developer
It may be necessary to enable registered users to download and apply for an account and download it yourself.
#Decompress xz -d cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz tar -xvf cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar #Copy file cp /root/cudnn-linux-x86_64-8.9.7.29_cuda12-archive/include/cudnn.* /usr/local/cuda/include/ cp /root/cudnn-linux-x86_64-8.9.7.29_cuda12-archive/lib/* /usr/local/cuda/lib64/ chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
So far, we successfully installed NVIDIA GPU graphics card in Debian 12.9.
After the server is installed, the GPU graphics card can also work normally. Next, let’s install python3.10. Before, we used the conda virtual environment to build it. This time, we directly installed python3.10, which is close to productive deployment.
Why install python3.10? Because ComfyUI officially recommends using 3.10 or 3.11, so here we will use v3.10 as an example to install it.
Five: Install the required dependency files
sudo apt update sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
Six: Download python installation files from the official website
#Download the installation file wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz #Decompress file tar -zvxf Python-3.10.0.tgz
Of course, there is a method of installing apt on ComfyUI. Later, I found that apt install python3.10 cannot install pip smoothly. After a while, I was busy, so we still use the old method here to download the original file to compile and install it.
7: Compile the file
cd Python-3.10.0/ ./configure --enable-optimizations Make make install
verify
python3.10 --version
Check the installation location
which python3.10
8: Set up soft connections
Because our platform is used to using python or pip directives directly, we set up a soft connection to python3.10 to facilitate our next operations
rm /usr/bin/python rm /usr/bin/pip ln -s /usr/local/bin/python3.10 /usr/bin/python ln -s /usr/local/bin/pip3.10 /usr/bin/pip
Nine: Set environment variables
vim ~/.bashrc #Add the following sentence: alias python='/usr/local/bin/python3.10' #Make effective source ~/.bashrc #Verify using python >>>exit();
Ten: Upgrade PIP
The default version of pip is not high. When installing ComfyUI, you often require the latest pip version. Here you can upgrade to the latest one
/usr/local/bin/python3.10 -m pip install --upgrade pip
So far, we have installed python3.10 on debian12.9
In the previous two sections, we have deployed the environment required by ComfyUI, and then it is time for us to install ComfyUI.
11: Set up the data disk
1. First of all, we need to add a 600GB hard-use to store the program and model of ComfyUI.
2. Set the loading point and enable it
Execute the following command
lsblk
3. Format the hard disk and set the loading point
The hard disk partition will be added
fdisk /dev/sda
Operation according to the above image
#Create file system mkfs.ext4 /dev/sda1 #Set loading point mkdir /app #mount hard disk mount /dev/sda1 /app
Please see the figure below, execute df -Th to view the loading status
Persistence operation
vim /etc/fstab
Add the following line:
/dev/sda1 /app ext4 defaults 0 0
Twelve: Start installing ComfyUI v0.3.14
This version only represents the latest version up to today. There will be updated versions in the future. It is recommended to refer to the official requirements when installing.
1. Cloning the code
git clone https://github.com/comfyanonymous/ComfyUI.git
2. Install pytorch
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu126
3. Install dependent files
cd /app/Comfyui pip install -r requirements.txt
4. Run
python main.py
5. Specify IP and port startup
python main.py --port 8188 --listen 192.168.XX.XX
Thirteen: Automatically start on
Edit the startup file
vim /etc/systemd/system/ComfyUI.service
Add the following
[Unit] Description=Run Python script main.py After=network.target [Service] ExecStart=/usr/bin/python /app/ComfyUI/main.py --port 8188 --listen 192.168.XX.XX Restart=always User=root [Install] WantedBy=multi-user.target
Execute the following command:
systemctl daemon-reload systemctl start ComfyUI.service systemctl enable ComfyUI.service
Fourteen: Error reporting
1. ModuleNotFoundError: No module named '_lzma'
The file path has already told us (/usr/local/lib/python3.10/lzma.py), solution:
apt install liblzma-dev -y pip install backports.lzma
Edit lzma.py
vim /usr/local/lib/python3.10/lzma.py
Modified to:
#Before modification from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_properties #After modification try: from _lzma import * from _lzma import _encode_filter_properties, _decode_filter_properties except ImportError: from backports.lzma import * from backports.lzma import _encode_filter_properties, _decode_filter_properties #Note the indentation of the line
Save and exit