From 4e42eee757f6a68d8eb3eb7c2be1f206da16e020 Mon Sep 17 00:00:00 2001 From: Ionite Date: Sun, 7 Apr 2024 17:37:47 -0400 Subject: [PATCH 1/2] Add default env vars, set SETUPTOOLS_USE_DISTUTILS=stdlib --- .../ViewModels/Settings/MainSettingsViewModel.cs | 4 ++-- StabilityMatrix.Core/Models/Settings/Settings.cs | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs index 0da8ab4c..c02c396b 100644 --- a/StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs @@ -365,7 +365,7 @@ public partial class MainSettingsViewModel : PageViewModelBase var viewModel = dialogFactory.Get(); // Load current settings - var current = settingsManager.Settings.EnvironmentVariables ?? new Dictionary(); + var current = settingsManager.Settings.UserEnvironmentVariables ?? new Dictionary(); viewModel.EnvVars = new ObservableCollection( current.Select(kvp => new EnvVarKeyPair(kvp.Key, kvp.Value)) ); @@ -385,7 +385,7 @@ public partial class MainSettingsViewModel : PageViewModelBase .EnvVars.Where(kvp => !string.IsNullOrWhiteSpace(kvp.Key)) .GroupBy(kvp => kvp.Key, StringComparer.Ordinal) .ToDictionary(g => g.Key, g => g.First().Value, StringComparer.Ordinal); - settingsManager.Transaction(s => s.EnvironmentVariables = newEnvVars); + settingsManager.Transaction(s => s.UserEnvironmentVariables = newEnvVars); } } diff --git a/StabilityMatrix.Core/Models/Settings/Settings.cs b/StabilityMatrix.Core/Models/Settings/Settings.cs index bf5e080f..01e22fd2 100644 --- a/StabilityMatrix.Core/Models/Settings/Settings.cs +++ b/StabilityMatrix.Core/Models/Settings/Settings.cs @@ -110,7 +110,18 @@ public class Settings public bool IsDiscordRichPresenceEnabled { get; set; } - public Dictionary? EnvironmentVariables { get; set; } + [JsonIgnore] + public Dictionary DefaultEnvironmentVariables { get; } = + new() { ["SETUPTOOLS_USE_DISTUTILS"] = "stdlib" }; + + [JsonPropertyName("EnvironmentVariables")] + public Dictionary? UserEnvironmentVariables { get; set; } + + [JsonIgnore] + public IReadOnlyDictionary EnvironmentVariables => + DefaultEnvironmentVariables + .Concat(UserEnvironmentVariables ?? []) + .ToDictionary(x => x.Key, x => x.Value); public HashSet? InstalledModelHashes { get; set; } = new(); From 43f3c28b9a9cf8ee60c168572b550fbb8e2210d7 Mon Sep 17 00:00:00 2001 From: Ionite Date: Mon, 8 Apr 2024 00:16:40 -0400 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d4dcaaf..91ae423d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2 ### Fixed - Fixed [#559](https://github.com/LykosAI/StabilityMatrix/issues/559) - "Unable to load bitmap from provided data" error in Checkpoints page - Fixed [#522](https://github.com/LykosAI/StabilityMatrix/issues/522) - Incorrect output directory path for latest Auto1111 +- Fixed CLIP Install errors due to setuptools distutils conflict, added default environment variable setting `SETUPTOOLS_USE_DISTUTILS=stdlib` ## v2.10.0-pre.2 ### Added