From aff3bf415a98da6c4f6d42f5d04cb987d37c839e Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Tue, 28 Apr 2026 01:22:27 -0700 Subject: [PATCH] Change pip constraints handling... ...and set "uv" and "constraints" parameters to keyword-only --- installer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/installer.py b/installer.py index caf874837..0099392a5 100644 --- a/installer.py +++ b/installer.py @@ -38,8 +38,7 @@ debug = log.debug if os.environ.get('SD_INSTALL_DEBUG', None) is not None else l setuptools, distutils = None, None # defined via ensure_base_requirements current_branch = None pip_log = '--log pip.log' if os.environ.get('SD_PIP_DEBUG', None) is not None else '' -main_directory = os.path.dirname(os.path.abspath(__file__)) -log_file = os.path.join(main_directory, 'sdnext.log') +log_file = os.path.join(os.path.dirname(__file__), 'sdnext.log') hostname = socket.gethostname() log_rolled = False first_call = True @@ -245,7 +244,7 @@ def cleanup_broken_packages(): pass -def pip(arg: str, ignore: bool = False, quiet: bool = True, uv = True) -> tuple[subprocess.CompletedProcess, str]: +def pip(arg: str, ignore: bool = False, quiet: bool = True, *, uv = True, constraints = True) -> tuple[subprocess.CompletedProcess, str]: t_start = time.time() originalArg = arg arg = arg.replace('>=', '==').strip() @@ -264,6 +263,8 @@ def pip(arg: str, ignore: bool = False, quiet: bool = True, uv = True) -> tuple[ all_args.append(arg) if env_args: all_args.append(env_args) + if constraints and "-c " not in env_args: + all_args.append("-c constraints.txt") if not quiet: log.debug(f'Running: {pipCmd}="{" ".join(all_args)}"') @@ -1287,7 +1288,6 @@ def install_requirements(): # set environment variables controling the behavior of various libraries def set_environment(): log.debug('Setting environment tuning') - os.environ.setdefault('PIP_CONSTRAINT', os.path.join(main_directory, 'constraints.txt')) os.environ.setdefault('ACCELERATE', 'True') os.environ.setdefault('ATTN_PRECISION', 'fp16') os.environ.setdefault('ClDeviceGlobalMemSizeAvailablePercent', '100')