Migrate to conda (#461)

* Migrate from venv to conda

* Migrate from venv to conda
This commit is contained in:
Henry Ruhs 2024-03-28 19:37:19 +01:00 committed by GitHub
parent 02cca313aa
commit 6fd53b9229
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 7 deletions

View File

@ -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

View File

@ -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:

View File

@ -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 =\
{

View File

@ -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',

View File

@ -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