Prerequisites
Before installing Real-ESRGAN, ensure you have the following requirements:Python
Python >= 3.7
PyTorch
PyTorch >= 1.7
Installation Steps
Install PyTorch
Install PyTorch (version >= 1.7) according to your system configuration. Visit pytorch.org for installation instructions specific to your CUDA version.Example for CUDA 11.8:Example for CPU only:
Install Real-ESRGAN
Install the Real-ESRGAN package in development mode:
Using
develop mode allows you to modify the source code and have changes take effect immediately without reinstalling.Alternative: Install via pip
For a simpler installation without cloning the repository, you can install Real-ESRGAN directly from PyPI:Package Dependencies
Real-ESRGAN requires the following key packages:basicsr (>= 1.4.2)
basicsr (>= 1.4.2)
BasicSR is an open-source image and video restoration toolbox used for both training and inference in Real-ESRGAN.
facexlib (>= 0.2.5)
facexlib (>= 0.2.5)
A collection of face-related functions used for face detection and analysis.
gfpgan (>= 1.3.5)
gfpgan (>= 1.3.5)
GFPGAN (Generative Facial Prior GAN) is used for optional face enhancement in Real-ESRGAN.
opencv-python
opencv-python
OpenCV is used for image I/O operations and basic image processing.
torch (>= 1.7)
torch (>= 1.7)
PyTorch is the deep learning framework powering Real-ESRGAN’s neural networks.
GPU Support
While Real-ESRGAN can run on CPU, using a GPU is highly recommended for practical performance. Image upscaling is significantly faster with CUDA-enabled GPUs.
Portable Executables (Alternative)
If you prefer not to set up a Python environment, portable executable files are available for Windows, Linux, and macOS: These executables use the NCNN framework and work on Intel/AMD/Nvidia GPUs without requiring Python or CUDA.Troubleshooting
ImportError: No module named 'basicsr'
ImportError: No module named 'basicsr'
Make sure you’ve installed BasicSR:
CUDA out of memory
CUDA out of memory
Try using the
--tile option with a smaller tile size (e.g., --tile 400) to reduce memory usage during inference.PyTorch not using GPU
PyTorch not using GPU
Ensure you’ve installed the correct PyTorch version for your CUDA version. Visit pytorch.org to find the right installation command.
Next Steps
Quick Start Guide
Learn how to upscale your first image with Real-ESRGAN