Browse Source

Actually use the environment variables during install & add pip cache clear button

pull/629/head
JT 7 months ago
parent
commit
f2dde2a50e
  1. 1
      CHANGELOG.md
  2. 27
      StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs
  3. 11
      StabilityMatrix.Avalonia/Views/Settings/MainSettingsPage.axaml
  4. 2
      StabilityMatrix.Core/Models/Packages/A3WebUI.cs
  5. 4
      StabilityMatrix.Core/Models/Packages/ComfyUI.cs
  6. 1
      StabilityMatrix.Core/Models/Packages/Fooocus.cs
  7. 1
      StabilityMatrix.Core/Models/Packages/FooocusMre.cs
  8. 3
      StabilityMatrix.Core/Models/Packages/KohyaSs.cs
  9. 2
      StabilityMatrix.Core/Models/Packages/OneTrainer.cs
  10. 1
      StabilityMatrix.Core/Models/Packages/RuinedFooocus.cs
  11. 2
      StabilityMatrix.Core/Models/Packages/SDWebForge.cs
  12. 2
      StabilityMatrix.Core/Models/Packages/StableDiffusionDirectMl.cs
  13. 2
      StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs
  14. 8
      StabilityMatrix.Core/Models/Packages/VoltaML.cs

1
CHANGELOG.md

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
- Fixed package launch not working when environment variable `SETUPTOOLS_USE_DISTUTILS` is set due to conflict with a default environment variable. User environment variables will now correctly override any default environment variables. - Fixed package launch not working when environment variable `SETUPTOOLS_USE_DISTUTILS` is set due to conflict with a default environment variable. User environment variables will now correctly override any default environment variables.
- Fixed "No refresh token found" error when failing to login with Lykos account in some cases. - Fixed "No refresh token found" error when failing to login with Lykos account in some cases.
- Fixed [#574](https://github.com/LykosAI/StabilityMatrix/issues/574) - local images not showing on macOS or Linux - Fixed [#574](https://github.com/LykosAI/StabilityMatrix/issues/574) - local images not showing on macOS or Linux
- Fixed [#578](https://github.com/LykosAI/StabilityMatrix/issues/578) - "python setup.py egg_info did not run successfully" failure when installing Auto1111 or SDWebUI Forge
## v2.10.0 ## v2.10.0
### Added ### Added

27
StabilityMatrix.Avalonia/ViewModels/Settings/MainSettingsViewModel.cs

@ -344,6 +344,33 @@ public partial class MainSettingsViewModel : PageViewModelBase
); );
} }
[RelayCommand]
private void ClearPipCache()
{
var pipCacheLocation = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"pip",
"cache"
);
if (Directory.Exists(pipCacheLocation))
{
Directory.Delete(pipCacheLocation, true);
notificationService.Show(
"Pip cache cleared",
"The pip cache has been cleared.",
NotificationType.Success
);
}
else
{
notificationService.Show(
"Pip cache not found",
"The pip cache was not found.",
NotificationType.Warning
);
}
}
[RelayCommand] [RelayCommand]
private void NavigateToSubPage(Type viewModelType) private void NavigateToSubPage(Type viewModelType)
{ {

11
StabilityMatrix.Avalonia/Views/Settings/MainSettingsPage.axaml

@ -160,7 +160,7 @@
</Grid> </Grid>
<!-- Environment Options --> <!-- Environment Options -->
<Grid RowDefinitions="Auto, Auto, Auto"> <Grid RowDefinitions="Auto, Auto, Auto, Auto">
<TextBlock <TextBlock
Margin="0,0,0,8" Margin="0,0,0,8"
FontWeight="Medium" FontWeight="Medium"
@ -194,6 +194,15 @@
</StackPanel> </StackPanel>
</ui:SettingsExpander.Footer> </ui:SettingsExpander.Footer>
</ui:SettingsExpander> </ui:SettingsExpander>
<ui:SettingsExpander
Grid.Row="3"
Margin="8,0"
Header="Pip Cache"
IconSource="ZipFolder">
<ui:SettingsExpander.Footer>
<Button Command="{Binding ClearPipCacheCommand}" Content="{x:Static lang:Resources.Action_Delete}" />
</ui:SettingsExpander.Footer>
</ui:SettingsExpander>
</Grid> </Grid>
<sg:SpacedGrid RowDefinitions="Auto, Auto"> <sg:SpacedGrid RowDefinitions="Auto, Auto">

2
StabilityMatrix.Core/Models/Packages/A3WebUI.cs

@ -204,6 +204,8 @@ public class A3WebUI(
await using var venvRunner = new PyVenvRunner(venvPath); await using var venvRunner = new PyVenvRunner(venvPath);
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false); await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);

4
StabilityMatrix.Core/Models/Packages/ComfyUI.cs

@ -195,8 +195,9 @@ public class ComfyUI(
// Setup venv // Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false); await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);
progress?.Report( progress?.Report(
@ -245,6 +246,7 @@ public class ComfyUI(
excludePattern: "torch" excludePattern: "torch"
); );
await venvRunner.PipUninstall("xformers", onConsoleOutput).ConfigureAwait(false);
await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false); await venvRunner.PipInstall(pipArgs, onConsoleOutput).ConfigureAwait(false);
progress?.Report(new ProgressReport(1, "Installed Package Requirements", isIndeterminate: false)); progress?.Report(new ProgressReport(1, "Installed Package Requirements", isIndeterminate: false));

1
StabilityMatrix.Core/Models/Packages/Fooocus.cs

@ -193,6 +193,7 @@ public class Fooocus(
) )
{ {
var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false); var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false);
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true)); progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true));

1
StabilityMatrix.Core/Models/Packages/FooocusMre.cs

@ -111,6 +111,7 @@ public class FooocusMre(
) )
{ {
var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false); var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false);
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
progress?.Report(new ProgressReport(-1f, "Installing torch...", isIndeterminate: true)); progress?.Report(new ProgressReport(-1f, "Installing torch...", isIndeterminate: true));

3
StabilityMatrix.Core/Models/Packages/KohyaSs.cs

@ -126,9 +126,12 @@ public class KohyaSs(
.ConfigureAwait(false); .ConfigureAwait(false);
progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true)); progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true));
// Setup venv // Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
// Extra dep needed before running setup since v23.0.x // Extra dep needed before running setup since v23.0.x

2
StabilityMatrix.Core/Models/Packages/OneTrainer.cs

@ -57,6 +57,8 @@ public class OneTrainer(
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
progress?.Report(new ProgressReport(-1f, "Installing requirements", isIndeterminate: true)); progress?.Report(new ProgressReport(-1f, "Installing requirements", isIndeterminate: true));

1
StabilityMatrix.Core/Models/Packages/RuinedFooocus.cs

@ -116,6 +116,7 @@ public class RuinedFooocus(
if (torchVersion == TorchVersion.Cuda) if (torchVersion == TorchVersion.Cuda)
{ {
var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false); var venvRunner = await SetupVenv(installLocation, forceRecreate: true).ConfigureAwait(false);
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true)); progress?.Report(new ProgressReport(-1f, "Installing requirements...", isIndeterminate: true));

2
StabilityMatrix.Core/Models/Packages/SDWebForge.cs

@ -142,6 +142,8 @@ public class SDWebForge(
await using var venvRunner = new PyVenvRunner(venvPath); await using var venvRunner = new PyVenvRunner(venvPath);
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false); await venvRunner.PipInstall("--upgrade pip wheel", onConsoleOutput).ConfigureAwait(false);

2
StabilityMatrix.Core/Models/Packages/StableDiffusionDirectMl.cs

@ -76,6 +76,8 @@ public class StableDiffusionDirectMl(
// Setup venv // Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
switch (torchVersion) switch (torchVersion)

2
StabilityMatrix.Core/Models/Packages/StableDiffusionUx.cs

@ -190,6 +190,8 @@ public class StableDiffusionUx(
// Setup venv // Setup venv
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);
switch (torchVersion) switch (torchVersion)

8
StabilityMatrix.Core/Models/Packages/VoltaML.cs

@ -21,12 +21,15 @@ public class VoltaML(
public override string DisplayName { get; set; } = "VoltaML"; public override string DisplayName { get; set; } = "VoltaML";
public override string Author => "VoltaML"; public override string Author => "VoltaML";
public override string LicenseType => "GPL-3.0"; public override string LicenseType => "GPL-3.0";
public override string LicenseUrl => "https://github.com/VoltaML/voltaML-fast-stable-diffusion/blob/main/License"; public override string LicenseUrl =>
"https://github.com/VoltaML/voltaML-fast-stable-diffusion/blob/main/License";
public override string Blurb => "Fast Stable Diffusion with support for AITemplate"; public override string Blurb => "Fast Stable Diffusion with support for AITemplate";
public override string LaunchCommand => "main.py"; public override string LaunchCommand => "main.py";
public override Uri PreviewImageUri => public override Uri PreviewImageUri =>
new("https://github.com/LykosAI/StabilityMatrix/assets/13956642/d9a908ed-5665-41a5-a380-98458f4679a8"); new(
"https://github.com/LykosAI/StabilityMatrix/assets/13956642/d9a908ed-5665-41a5-a380-98458f4679a8"
);
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Simple; public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Simple;
@ -155,6 +158,7 @@ public class VoltaML(
progress?.Report(new ProgressReport(-1, "Setting up venv", isIndeterminate: true)); progress?.Report(new ProgressReport(-1, "Setting up venv", isIndeterminate: true));
await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv"));
venvRunner.WorkingDirectory = installLocation; venvRunner.WorkingDirectory = installLocation;
venvRunner.EnvironmentVariables = settingsManager.Settings.EnvironmentVariables;
await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false); await venvRunner.Setup(true, onConsoleOutput).ConfigureAwait(false);

Loading…
Cancel
Save