diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51fa80e5..8da617ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,6 @@ jobs: uses: actions/setup-python@v2 with: python-version: '3.10' - - run: python install.py --onnxruntime default --skip-venv + - run: python install.py --onnxruntime default --skip-conda - run: pip install pytest - run: pytest diff --git a/facefusion/core.py b/facefusion/core.py index 72301f6a..1c0897f9 100755 --- a/facefusion/core.py +++ b/facefusion/core.py @@ -187,6 +187,7 @@ def apply_args(program : ArgumentParser) -> None: def run(program : ArgumentParser) -> None: apply_args(program) logger.init(facefusion.globals.log_level) + if facefusion.globals.system_memory_limit > 0: limit_system_memory(facefusion.globals.system_memory_limit) if facefusion.globals.force_download: diff --git a/facefusion/installer.py b/facefusion/installer.py index 1b5ec7b3..d38a5340 100644 --- a/facefusion/installer.py +++ b/facefusion/installer.py @@ -9,6 +9,9 @@ from argparse import ArgumentParser, HelpFormatter from facefusion import metadata, wording +if platform.system().lower() == 'darwin': + os.environ['SYSTEM_VERSION_COMPAT'] = '0' + ONNXRUNTIMES : Dict[str, Tuple[str, str]] = {} if platform.system().lower() == 'darwin': @@ -28,7 +31,7 @@ if platform.system().lower() == 'windows': def cli() -> None: program = ArgumentParser(formatter_class = lambda prog: HelpFormatter(prog, max_help_position = 130)) program.add_argument('--onnxruntime', help = wording.get('help.install_dependency').format(dependency = 'onnxruntime'), choices = ONNXRUNTIMES.keys()) - program.add_argument('--skip-venv', help = wording.get('help.skip_venv'), action = 'store_true') + program.add_argument('--skip-conda', help = wording.get('help.skip_conda'), action = 'store_true') program.add_argument('-v', '--version', version = metadata.get('name') + ' ' + metadata.get('version'), action = 'version') run(program) @@ -37,10 +40,8 @@ def run(program : ArgumentParser) -> None: args = program.parse_args() python_id = 'cp' + str(sys.version_info.major) + str(sys.version_info.minor) - if platform.system().lower() == 'darwin': - os.environ['SYSTEM_VERSION_COMPAT'] = '0' - if not args.skip_venv: - os.environ['PIP_REQUIRE_VIRTUALENV'] = '1' + if not args.skip_conda and 'CONDA_PREFIX' not in os.environ: + sys.exit(1) if args.onnxruntime: answers =\ { diff --git a/facefusion/wording.py b/facefusion/wording.py index e101668e..dd971bdc 100755 --- a/facefusion/wording.py +++ b/facefusion/wording.py @@ -52,7 +52,7 @@ WORDING : Dict[str, Any] =\ { # installer 'install_dependency': 'select the variant of {dependency} to install', - 'skip_venv': 'skip the virtual environment check', + 'skip_conda': 'skip the conda environment check', # general 'source': 'choose single or multiple source images or audios', 'target': 'choose single target image or video', diff --git a/install.py b/install.py index 9ce0d08a..6c07cb96 100755 --- a/install.py +++ b/install.py @@ -1,7 +1,9 @@ #!/usr/bin/env python3 +import os import subprocess +os.environ['PIP_BREAK_SYSTEM_PACKAGES'] = '1' subprocess.call([ 'pip', 'install' , 'inquirer', '-q' ]) from facefusion import installer