diff --git a/CHANGELOG.md b/CHANGELOG.md index 02cb7328a..b92e31f6e 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 26671b2b9..296b1202e 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 c3cc382f5..ba0cdf8cf 100644 --- a/StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs +++ b/StabilityMatrix.Avalonia/Helpers/WindowsPrerequisiteHelper.cs @@ -20,15 +20,14 @@ namespace StabilityMatrix.Avalonia.Helpers; [SupportedOSPlatform("windows")] -public class WindowsPrerequisiteHelper : IPrerequisiteHelper +public class WindowsPrerequisiteHelper( + 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 const string VcRedistDownloadUrl = "https://aka.ms/vs/16/release/vc_redist.x64.exe"; private const string TkinterDownloadUrl = "https://cdn.lykos.ai/tkinter-cpython-embedded-3.10.11-win-x64.zip"; @@ -62,19 +61,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 +152,11 @@ public async Task InstallPackageRequirements( { 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 4d3441735..c00a53fcf 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 c38c0e1f2..c9cdf0411 100644 --- a/StabilityMatrix.Core/Models/Packages/KohyaSs.cs +++ b/StabilityMatrix.Core/Models/Packages/KohyaSs.cs @@ -50,6 +50,8 @@ IPyRunner runner 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 override async Task InstallPackage( 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 d113cb2dc..d4a92c342 100644 --- a/StabilityMatrix.Core/Models/Packages/OneTrainer.cs +++ b/StabilityMatrix.Core/Models/Packages/OneTrainer.cs @@ -41,6 +41,8 @@ IPrerequisiteHelper prerequisiteHelper 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,