{"record":{"id":"4681e3efba20115b","repo":"deepfakes/faceswap","slug":"this-program-requires-at-least-python-3-11","errorCode":null,"errorMessage":"This program requires at least python 3.11","messagePattern":"This program requires at least python 3\\.11","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"critical","filePath":"tools.py","lineNumber":18,"sourceCode":"#!/usr/bin/env python3\n\"\"\" The master tools.py script \"\"\"\nimport gettext\nimport os\nimport sys\n\nfrom importlib import import_module\n\n# Importing the various tools\nfrom lib.cli.args import FullHelpArgumentParser\n\n# LOCALES\n_LANG = gettext.translation(\"tools\", localedir=\"locales\", fallback=True)\n_ = _LANG.gettext\n\n# Python version check\nif sys.version_info < (3, 11):\n    raise ValueError(\"This program requires at least python 3.11\")\n\n\ndef bad_args(*args):  # pylint:disable=unused-argument\n    \"\"\" Print help on bad arguments \"\"\"\n    PARSER.print_help()\n    sys.exit(0)\n\n\ndef _get_cli_opts():\n    \"\"\" Optain the subparsers and cli options for available tools \"\"\"\n    base_path = os.path.realpath(os.path.dirname(sys.argv[0]))\n    tools_dir = os.path.join(base_path, \"tools\")\n    for tool_name in sorted(os.listdir(tools_dir)):\n        cli_file = os.path.join(tools_dir, tool_name, \"cli.py\")\n        if os.path.exists(cli_file):\n            mod = \".\".join((\"tools\", tool_name, \"cli\"))\n            module = import_module(mod)\n            cliarg_class = getattr(module, f\"{tool_name.title()}Args\")","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/tools.py#L1-L36","documentation":"Module-import-time guard in the top-level tools.py dispatcher: if the interpreter's sys.version_info is below (3, 11) a ValueError is raised immediately. Faceswap's codebase uses Python 3.11+ syntax/features, so older interpreters cannot even parse the tool modules.","triggerScenarios":"Running `python tools.py ...` (or importing tools.py) with python3.10 or older — e.g. because 'python' resolves to an old system interpreter, or the virtualenv was built from an outdated python, or a distro package was launched with the wrong binary.","commonSituations":"System default python being 3.8–3.10; activating the wrong conda env; upgrading Faceswap to a version that bumped the minimum Python without rebuilding the venv.","solutions":["Install/activate Python 3.11+ and re-run: `python3.11 tools.py ...` or rebuild the virtualenv with it.","If you use conda: `conda create -n faceswap python=3.12 && conda activate faceswap`.","Check what 'python' resolves to (`python --version`, `which python`) and fix PATH/venv activation order."],"exampleFix":"# before\n$ python --version\nPython 3.10.12\n$ python tools.py effmpeg\nValueError: This program requires at least python 3.11\n\n# after\n$ python3.11 -m venv fsenv && source fsenv/bin/activate\n$ python tools.py effmpeg","handlingStrategy":"validation","validationCode":"import sys\nif sys.version_info < (3, 11):\n    raise SystemExit(\"Faceswap needs Python 3.11+; you are on \" + sys.version.split()[0])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin the venv/conda env to a specific Python 3.11+ interpreter and record it in setup docs.","Add `python_requires = \">=3.11\"` awareness to install scripts so the env fails at install time, not run time."],"tags":["faceswap","python-version","environment","startup"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}