Skip to main content

Prerequisites

Before installing Real-ESRGAN, ensure you have the following requirements:

Python

Python >= 3.7

PyTorch

PyTorch >= 1.7
We recommend using Anaconda or Miniconda to manage your Python environment.

Installation Steps

1

Clone the Repository

First, clone the Real-ESRGAN repository from GitHub:
2

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:
3

Install Dependencies

Install the required Python packages:
4

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.
5

Verify Installation

Verify that Real-ESRGAN is installed correctly:

Alternative: Install via pip

For a simpler installation without cloning the repository, you can install Real-ESRGAN directly from PyPI:
The pip package may not include the latest features and models. For development or access to all models, we recommend installing from the source repository.

Package Dependencies

Real-ESRGAN requires the following key packages:
BasicSR is an open-source image and video restoration toolbox used for both training and inference in Real-ESRGAN.
A collection of face-related functions used for face detection and analysis.
GFPGAN (Generative Facial Prior GAN) is used for optional face enhancement in Real-ESRGAN.
OpenCV is used for image I/O operations and basic image processing.
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.
To check if PyTorch can access your GPU:

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.
The portable executables may not support all features available in the Python implementation (such as --outscale and --face_enhance).

Troubleshooting

Make sure you’ve installed BasicSR:
Try using the --tile option with a smaller tile size (e.g., --tile 400) to reduce memory usage during inference.
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