setup Module

Install packages for faceswap.py

class setup.Checks(environment: Environment)

Pre-installation checks

Parameters:

environment (Environment) – Environment class holding information about the running system

class setup.Environment(updater: bool = False)

The current install environment

Parameters:

updater (bool) – True if the script is being called by Faceswap’s internal updater. False if full setup is running. Default: False

property cuda_version: str

The detected globally installed Cuda Version

property cudnn_version: str

The detected globally installed cuDNN Version

set_backend(backend: Literal['nvidia', 'apple_silicon', 'cpu', 'rocm']) None

Set the backend to install for

Parameters:

backend (Literal['nvidia', 'apple_silicon', 'cpu', 'rocm']) – The backend to setup faceswap for

Return type:

None

set_config() None

Set the backend in the faceswap config file

Return type:

None

set_requirements(requirements: str) None

Validate that the requirements are compatible with the running Python version and set the requirements file version to install use

Parameters:
  • backend – The requirements file version to use for install

  • requirements (str)

Return type:

None

class setup.Install(environment: Environment, is_gui: bool = False)

Handles installation of Faceswap requirements

Parameters:
  • environment (Environment) – Environment class holding information about the running system

  • is_gui (bool) – True if the caller is the Faceswap GUI. Used to prevent output of progress bars which get scrambled in the GUI

class setup.Installer(environment: Environment, packages: list[str], command: list[str], is_conda: bool, is_gui: bool)

Uses the python Subprocess module to install packages.

Parameters:
  • environment (Environment) – Environment class holding information about the running system

  • packages (list[str]) – The list of package names that are to be installed

  • command (list[str]) – The command to run

  • is_conda (bool) – True if conda install command is running. False if pip install command is running

  • is_gui (bool) – True if the process is being called from the Faceswap GUI

__call__() int

Install a package using the Subprocess module

Return type:

The return code of the package install process

class setup.RequiredPackages(environment: Environment)

Holds information about installed and required packages. Handles updating dependencies based on running platform/backend

Parameters:

environment (Environment) – Environment class holding information about the running system

property packages_need_install: bool

True if there are packages available that need to be installed

pip_arguments

Any additional pip arguments that are required for installing from pip for the given backend

class setup.Status(is_conda: bool)

Simple Status output for intercepting Conda/Pip installs and keeping the terminal clean

Parameters:

is_conda (bool) – True if installing packages from Conda. False if installing from pip

__call__(line: str) None

Update the output status with the given line

Parameters:

line (str) – A cleansed line from either Conda or Pip installers

Return type:

None

close() None

Reset all progress bars and re-enable the cursor

Return type:

None

class setup.Tips

Display installation Tips

classmethod macos() None

Output Tips for macOS

Return type:

None

classmethod pip() None

Pip Tips

Return type:

None

Classes

Checks(environment)

Pre-installation checks

Environment([updater])

The current install environment

Install(environment[, is_gui])

Handles installation of Faceswap requirements

Installer(environment, packages, command, ...)

Uses the python Subprocess module to install packages.

RequiredPackages(environment)

Holds information about installed and required packages.

Status(is_conda)

Simple Status output for intercepting Conda/Pip installs and keeping the terminal clean

Tips()

Display installation Tips