diff --git a/CHANGELOG.md b/CHANGELOG.md index 02cb7328..b92e31f6 100644 --- a/CHANGELOG.md +++ b/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 - Increased timeout on Recommended Models call to prevent potential timeout errors on slow connections - Fixed SynchronizationLockException when saving settings +- Fixed missing tkinter dependency for OneTrainer on Windows ## v2.8.0 ### Added diff --git a/StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs b/StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs index 26671b2b..296b1202 100644 --- a/StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs +++ b/StabilityMatrix.Avalonia/Helpers/UnixPrerequisiteHelper.cs @@ -23,14 +23,14 @@ namespace StabilityMatrix.Avalonia.Helpers; [SupportedOSPlatform("macos")] [SupportedOSPlatform("linux")] -public class UnixPrerequisiteHelper : IPrerequisiteHelper +public class UnixPrerequisiteHelper( + IDownloadService downloadService, + ISettingsManager settingsManager, + IPyRunner pyRunner +) : IPrerequisiteHelper { 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 AssetsDir => HomeDir.JoinDir("Assets"); @@ -46,17 +46,6 @@ public class UnixPrerequisiteHelper : IPrerequisiteHelper // Cached store of whether or not git is installed private bool? isGitInstalled; - public UnixPrerequisiteHelper( - IDownloadService downloadService, - ISettingsManager settingsManager, - IPyRunner pyRunner - ) - { - this.downloadService = downloadService; - this.settingsManager = settingsManager; - this.pyRunner = pyRunner; - } - private async Task CheckIsGitInstalled() { var result = await ProcessRunner.RunBashCommand("git --version"); diff --git a/StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs b/StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs index c3cc382f..591302bc 100644 --- a/StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs +++ b/StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs @@ -20,14 +20,16 @@ using StabilityMatrix.Core.Services; namespace StabilityMatrix.Avalonia.Helpers; [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 readonly IGitHubClient gitHubClient; - private readonly IDownloadService downloadService; - private readonly ISettingsManager settingsManager; - private readonly IPyRunner pyRunner; + private readonly IGitHubClient gitHubClient = gitHubClient; private const string VcRedistDownloadUrl = "https://aka.ms/vs/16/release/vc_redist.x64.exe"; private const string TkinterDownloadUrl = @@ -62,19 +64,6 @@ public class WindowsPrerequisiteHelper : IPrerequisiteHelper public string GitBinPath => Path.Combine(PortableGitInstallDir, "bin"); 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( ProcessArgs args, Action? onProcessOutput, @@ -166,6 +155,11 @@ public class WindowsPrerequisiteHelper : IPrerequisiteHelper { await InstallNodeIfNecessary(progress); } + + if (prerequisites.Contains(PackagePrerequisite.Tkinter)) + { + await InstallTkinterIfNecessary(progress); + } } public async Task InstallAllIfNecessary(IProgress? progress = null) diff --git a/StabilityMatrix.Core/Models/PackagePrerequisite.cs b/StabilityMatrix.Core/Models/PackagePrerequisite.cs index 4d344173..c00a53fc 100644 --- a/StabilityMatrix.Core/Models/PackagePrerequisite.cs +++ b/StabilityMatrix.Core/Models/PackagePrerequisite.cs @@ -7,5 +7,6 @@ public enum PackagePrerequisite Git, Node, Dotnet7, - Dotnet8 + Dotnet8, + Tkinter, } diff --git a/StabilityMatrix.Core/Models/Packages/KohyaSs.cs b/StabilityMatrix.Core/Models/Packages/KohyaSs.cs index c38c0e1f..c9cdf041 100644 --- a/StabilityMatrix.Core/Models/Packages/KohyaSs.cs +++ b/StabilityMatrix.Core/Models/Packages/KohyaSs.cs @@ -50,6 +50,8 @@ public class KohyaSs( public override IEnumerable AvailableTorchVersions => [TorchVersion.Cuda]; public override IEnumerable AvailableSharedFolderMethods => new[] { SharedFolderMethod.None }; + public override IEnumerable Prerequisites => + base.Prerequisites.Concat([PackagePrerequisite.Tkinter]); public override List LaunchOptions => [ @@ -114,12 +116,6 @@ public class KohyaSs( Action? 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)); // Setup venv await using var venvRunner = new PyVenvRunner(Path.Combine(installLocation, "venv")); diff --git a/StabilityMatrix.Core/Models/Packages/OneTrainer.cs b/StabilityMatrix.Core/Models/Packages/OneTrainer.cs index d113cb2d..d4a92c34 100644 --- a/StabilityMatrix.Core/Models/Packages/OneTrainer.cs +++ b/StabilityMatrix.Core/Models/Packages/OneTrainer.cs @@ -41,6 +41,8 @@ public class OneTrainer( public override PackageDifficulty InstallerSortOrder => PackageDifficulty.Nightmare; public override bool OfferInOneClickInstaller => false; public override bool ShouldIgnoreReleases => true; + public override IEnumerable Prerequisites => + base.Prerequisites.Concat([PackagePrerequisite.Tkinter]); public override async Task InstallPackage( string installLocation,