setup module
Install packages for faceswap.py
- class setup.Checks(environment: Environment)
Bases:
object
Pre-installation checks
- Parameters:
environment (
Environment
) – Environment class holding information about the running system
- class setup.CudaCheck
Bases:
object
Find the location of system installed Cuda and cuDNN on Windows and Linux.
- class setup.Environment(updater: bool = False)
Bases:
object
The current install environment
- Parameters:
updater (bool, Optional) –
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
- Type:
str
- property cudnn_version: str
The detected globally installed cuDNN Version
- Type:
str
- property encoding: str
Get system encoding
- property is_admin: bool
Check whether user is admin
- property is_conda: bool
Check whether using Conda
- property is_virtualenv: bool
Check whether this is a virtual environment
- property os_version: tuple[str, str]
Get OS Version
- property py_version: tuple[str, str]
Get Python Version
- set_config() None
Set the backend in the faceswap config file
- class setup.Install(environment: Environment, is_gui: bool = False)
Bases:
object
Handles installation of Faceswap requirements
- Parameters:
environment (
Environment
) – Environment class holding information about the running systemis_gui (bool, Optional) –
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, package: str, command: list[str], is_gui: bool)
Bases:
object
Parent class for package installers.
PyWinPty is used for Windows, Pexpect is used for Linux, as these can provide us with realtime output.
Subprocess is used as a fallback if any of the above fail, but this caches output, so it can look like the process has hung to the end user
- Parameters:
environment (
Environment
) – Environment class holding information about the running systempackage (str) – The package name that is being installed
command (list) – The command to run
is_gui (bool) –
True
if the process is being called from the Faceswap GUI
- call() int
Override for package installer specific logic.
- Returns:
The return code of the package install process
- Return type:
int
- class setup.Packages(environment: Environment)
Bases:
object
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
- check_missing_dependencies() None
Check for missing dependencies and add to
_missing_packages
- get_required_packages() None
Load the requirements from the backend specific requirements list
- property packages_need_install: bool
True
if there are packages available that need to be installed- Type:
bool
- property prerequisites: list[tuple[str, list[tuple[str, str]]]]
Any required packages that the installer needs prior to installing the faceswap environment on the specific platform that are not already installed
- Type:
list
- property to_install: list[tuple[str, list[tuple[str, str]]]]
The required packages that need to be installed
- Type:
list
- property to_install_conda: list[tuple[list[str] | str, str]]
The required conda packages that need to be installed
- Type:
list
- update_tf_dep() None
Update Tensorflow Dependency.
Selects a compatible version of Tensorflow for a globally installed GPU library
- class setup.PexpectInstaller(environment: Environment, package: str, command: list[str], is_gui: bool)
Bases:
Installer
Package installer for Linux/macOS using Pexpect
Uses Pexpect for installing packages allowing access to realtime feedback
- Parameters:
environment (
Environment
) – Environment class holding information about the running systempackage (str) – The package name that is being installed
command (list) – The command to run
is_gui (bool) –
True
if the process is being called from the Faceswap GUI
- call() int
Install a package using the Pexpect module
- Returns:
The return code of the package install process
- Return type:
int
- class setup.ProgressBar
Bases:
object
Simple progress bar using STDLib for intercepting Conda installs and keeping the terminal from getting jumbled
- close() None
Reset all progress bars and re-enable the cursor
- class setup.ROCmCheck
Bases:
object
Find the location of system installed ROCm on Linux
- property is_valid
True if ROCm has been detected and is between the minimum and maximum compatible versions otherwise
False
- Type:
bool
- class setup.SubProcInstaller(environment: Environment, package: str, command: list[str], is_gui: bool)
Bases:
Installer
The fallback package installer if either of the OS specific installers fail.
Uses the python Subprocess module to install packages. Feedback does not return in realtime so the process can look like it has hung to the end user
- Parameters:
environment (
Environment
) – Environment class holding information about the running systempackage (str) – The package name that is being installed
command (list) – The command to run
is_gui (bool) –
True
if the process is being called from the Faceswap GUI
- call() int
Install a package using the Subprocess module
- Returns:
The return code of the package install process
- Return type:
int
- class setup.Tips
Bases:
object
Display installation Tips
- classmethod docker_cuda() None
Output Tips for Docker with Cuda
- classmethod docker_no_cuda() None
Output Tips for Docker without Cuda
- classmethod macos() None
Output Tips for macOS
- classmethod pip() None
Pip Tips
- class setup.WinPTYInstaller(environment: Environment, package: str, command: list[str], is_gui: bool)
Bases:
Installer
Package installer for Windows using WinPTY
Spawns a pseudo PTY for installing packages allowing access to realtime feedback
- Parameters:
environment (
Environment
) – Environment class holding information about the running systempackage (str) – The package name that is being installed
command (list) – The command to run
is_gui (bool) –
True
if the process is being called from the Faceswap GUI
- call() int
Install a package using the PyWinPTY module
- Returns:
The return code of the package install process
- Return type:
int