BasicSR Installation Guide for Windows

From Upscale Wiki
This is the latest revision of this page; it has no approved revision.
Jump to navigation Jump to search

We will install some tools first to make installing the dependencies, BasicSR and ESRGAN itself easier.


This Guide is currently in Alpha, use it at your own risk!

Before you start with this guide, make sure that you have nothing from NVIDIA installed.

Before you start with this guide, make sure that you have no Python, Anaconda, Miniconda, (other Python distribution) installed.

If you have something from Nvidia installed or an existing Python installation, uninstall them first in the Windows Control pannel. To check that there really is no Python installation left, open a CMD window and type python if nothing happens you are good to go.


Chocolatey is a package manager for Windows, you can also install all of the programs we will install with it in the future manually, if you want to do so, skip those steps.

  1. Open a PowerShell window as an admin. (On Windows 10 rightclick the start symbol (four squares) then select Windows PowerShell (Admin))


  1. Enter: Get-ExecutionPolicy
    • If it returns Restricted Enter: Set-ExecutionPolicy AllSigned
  2. Enter: Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString(''))
  3. Close PowerShell (!This is important!)
  4. Reopen PowerShell as an admin.

Nvidia Driver

  1. Enter: choco install nvidia-display-driver


  1. Enter: choco install cuda


  1. Enter: choco install python3 --params "/InstallDir:C:\Python3"
If you want to install Python in another location you can just modify the path to whatever you want. Example to install it in D:\PythonForLife choco install python3 --params "/InstallDir:D:\PythonForLife"

Git (Bash)

  1. Enter: choco install git --params "/GitAndUnixToolsOnPath /NoGuiHereIntegration"
/GitAndUnixToolsOnPath will add many Unix tools to your path, optional
/NoGuiHereIntegration Personally I don't like the GUI that comes with Git, I recommend to use any other instead this switch will remove the Git GUI entry from the windows explorer context menu.


  1. Enter: choco install imagemagick

Python Dependencies

  1. Open a shell of your choice as an admin. (PowerShell, CMD or Git Bash)


  • If you have a Nvidia graphic card enter the following command in the cmd and press enter:
    1. pip install torch===1.4.0 torchvision===0.5.0 -f
  • If you have an AMD / Intel graphic card enter the following command in the cmd and press enter:
    1. pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f
  • If the command for your system won’t work for you, please report it. In the meantime, you can get an up to date version here on the Pytorch Website. Select Stable, Windows, Pip, your Python version and your CUDA version (should be the newest) or None for AMD / Intel users.


  1. Enter: pip install opencv-python

The Neural Networks

In my example we will install ESRGAN and BasicSR in a project folder called nn (neural network) in the drive root of C. You can change the path if you want to, but keep it as short as you can, since windows has a limitation on how long paths can be.

We will also work with Bash here, you can do this in other shells too, but this guide will use Git Bash, that we installed above.

  1. Open a Git Bash window.
  2. Enter:mkdir -p /c/nn/
  3. Enter:cd /c/nn/


  1. Enter:git clone


  1. Enter:git clone

Neural Testing Scripts

  1. Enter:

Neural Training Scripts

  1. Enter: