Browse Source

Add Tkinter prerequisite and handle it

pull/438/head^2
JT 10 months ago
parent
commit
19ec7e0612
  1. 1
      CHANGELOG.md
  2. 21
      StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs
  3. 30
      StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs
  4. 3
      StabilityMatrix.Core/Models/PackagePrerequisite.cs
  5. 8
      StabilityMatrix.Core/Models/Packages/KohyaSs.cs
  6. 2
      StabilityMatrix.Core/Models/Packages/OneTrainer.cs

1
CHANGELOG.md

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning 2.0](https://semver.org/spec/v2
- Fixed failing InvokeAI install on macOS due to missing nodejs - Fixed failing InvokeAI install on macOS due to missing nodejs
- Increased timeout on Recommended Models call to prevent potential timeout errors on slow connections - Increased timeout on Recommended Models call to prevent potential timeout errors on slow connections
- Fixed SynchronizationLockException when saving settings - Fixed SynchronizationLockException when saving settings
- Fixed missing tkinter dependency for OneTrainer on Windows
## v2.8.0 ## v2.8.0
### Added ### Added

21
StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs

@ -23,14 +23,14 @@ namespace StabilityMatrix.Avalonia.Helpers;
[SupportedOSPlatform("macos")] [SupportedOSPlatform("macos")]
[SupportedOSPlatform("linux")] [SupportedOSPlatform("linux")]
public class UnixPrerequisiteHelper : IPrerequisiteHelper public class UnixPrerequisiteHelper(
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
) : IPrerequisiteHelper
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IDownloadService downloadService;
private readonly ISettingsManager settingsManager;
private readonly IPyRunner pyRunner;
private DirectoryPath HomeDir => settingsManager.LibraryDir; private DirectoryPath HomeDir => settingsManager.LibraryDir;
private DirectoryPath AssetsDir => HomeDir.JoinDir("Assets"); private DirectoryPath AssetsDir => HomeDir.JoinDir("Assets");
@ -46,17 +46,6 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper
// Cached store of whether or not git is installed // Cached store of whether or not git is installed
private bool? isGitInstalled; private bool? isGitInstalled;
public UnixPrerequisiteHelper(
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
)
{
this.downloadService = downloadService;
this.settingsManager = settingsManager;
this.pyRunner = pyRunner;
}
private async Task<bool> CheckIsGitInstalled() private async Task<bool> CheckIsGitInstalled()
{ {
var result = await ProcessRunner.RunBashCommand("git --version"); var result = await ProcessRunner.RunBashCommand("git --version");

30
StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs

@ -20,14 +20,16 @@ using StabilityMatrix.Core.Services;
namespace StabilityMatrix.Avalonia.Helpers; namespace StabilityMatrix.Avalonia.Helpers;
[SupportedOSPlatform("windows")] [SupportedOSPlatform("windows")]
public class WindowsPrerequisiteHelper : IPrerequisiteHelper public class WindowsPrerequisiteHelper(
IGitHubClient gitHubClient,
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
) : IPrerequisiteHelper
{ {
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly IGitHubClient gitHubClient; private readonly IGitHubClient gitHubClient = gitHubClient;
private readonly IDownloadService downloadService;
private readonly ISettingsManager settingsManager;
private readonly IPyRunner pyRunner;
private const string VcRedistDownloadUrl = "https://aka.ms/vs/16/release/vc_redist.x64.exe"; private const string VcRedistDownloadUrl = "https://aka.ms/vs/16/release/vc_redist.x64.exe";
private const string TkinterDownloadUrl = private const string TkinterDownloadUrl =
@ -62,19 +64,6 @@ public class WindowsPrerequisiteHelper : IPrerequisiteHelper
public string GitBinPath => Path.Combine(PortableGitInstallDir, "bin"); public string GitBinPath => Path.Combine(PortableGitInstallDir, "bin");
public bool IsPythonInstalled => File.Exists(PythonDllPath); public bool IsPythonInstalled => File.Exists(PythonDllPath);
public WindowsPrerequisiteHelper(
IGitHubClient gitHubClient,
IDownloadService downloadService,
ISettingsManager settingsManager,
IPyRunner pyRunner
)
{
this.gitHubClient = gitHubClient;
this.downloadService = downloadService;
this.settingsManager = settingsManager;
this.pyRunner = pyRunner;
}
public async Task RunGit( public async Task RunGit(
ProcessArgs args, ProcessArgs args,
Action<ProcessOutput>? onProcessOutput, Action<ProcessOutput>? onProcessOutput,
@ -166,6 +155,11 @@ public class WindowsPrerequisiteHelper : IPrerequisiteHelper
{ {
await InstallNodeIfNecessary(progress); await InstallNodeIfNecessary(progress);
} }
if (prerequisites.Contains(PackagePrerequisite.Tkinter))
{
await InstallTkinterIfNecessary(progress);
}
} }
public async Task InstallAllIfNecessary(IProgress<ProgressReport>? progress = null) public async Task InstallAllIfNecessary(IProgress<ProgressReport>? progress = null)

3
StabilityMatrix.Core/Models/PackagePrerequisite.cs

@ -7,5 +7,6 @@ public enum PackagePrerequisite
Git, Git,
Node, Node,
Dotnet7, Dotnet7,
Dotnet8 Dotnet8,
Tkinter,
} }

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

@ -50,6 +50,8 @@ public class KohyaSs(
public override IEnumerable<TorchVersion> AvailableTorchVersions => [TorchVersion.Cuda]; public override IEnumerable<TorchVersion> AvailableTorchVersions => [TorchVersion.Cuda];
public override IEnumerable<SharedFolderMethod> AvailableSharedFolderMethods => public override IEnumerable<SharedFolderMethod> AvailableSharedFolderMethods =>
new[] { SharedFolderMethod.None }; new[] { SharedFolderMethod.None };
public override IEnumerable<PackagePrerequisite> Prerequisites =>
base.Prerequisites.Concat([PackagePrerequisite.Tkinter]);
public override List<LaunchOptionDefinition> LaunchOptions => public override List<LaunchOptionDefinition> LaunchOptions =>
[ [
@ -114,12 +116,6 @@ public class KohyaSs(
Action<ProcessOutput>? onConsoleOutput = null Action<ProcessOutput>? onConsoleOutput = null
) )
{ {
if (Compat.IsWindows)
{
progress?.Report(new ProgressReport(-1f, "Installing prerequisites...", isIndeterminate: true));
await PrerequisiteHelper.InstallTkinterIfNecessary(progress).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"));

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

@ -41,6 +41,8 @@ public class OneTrainer(
public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Nightmare; public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Nightmare;
public override bool OfferInOneClickInstaller => false; public override bool OfferInOneClickInstaller => false;
public override bool ShouldIgnoreReleases => true; public override bool ShouldIgnoreReleases => true;
public override IEnumerable<PackagePrerequisite> Prerequisites =>
base.Prerequisites.Concat([PackagePrerequisite.Tkinter]);
public override async Task InstallPackage( public override async Task InstallPackage(
string installLocation, string installLocation,

Loading…
Cancel
Save