Skip to content

Commit

Permalink
Merge pull request #24 from the-database/dev
Browse files Browse the repository at this point in the history
fix python deps install when portable path has spaces
  • Loading branch information
the-database authored Jul 24, 2024
2 parents 5a612a3 + c762b81 commit b59ea4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion MangaJaNaiConverterGui/Services/PythonService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ public string InstallUpdatePythonDependenciesCommand
"psutil^>=6.0.0"
};

return $@"{PythonPath} -m pip install torch^>=2.3.1 torchvision^>=0.18.1 --index-url https://download.pytorch.org/whl/cu121 && {PythonPath} -m pip install {string.Join(" ", dependencies)}";
var relPythonPath = @".\python\python\python.exe";

return $@"{relPythonPath} -m pip install torch^>=2.3.1 torchvision^>=0.18.1 --index-url https://download.pytorch.org/whl/cu121 && {relPythonPath} -m pip install {string.Join(" ", dependencies)}";
}
}

Expand Down
5 changes: 3 additions & 2 deletions MangaJaNaiConverterGui/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -780,12 +780,12 @@ public async Task<string[]> InitializeDeviceList()
{
_runningProcess = process;
process.StartInfo.FileName = "cmd.exe";
process.StartInfo.Arguments = @$"/C {_pythonService.PythonPath} .\src\device_list.py";
process.StartInfo.Arguments = @$"/C .\python\python\python.exe .\src\device_list.py";
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WorkingDirectory = Path.GetFullPath(@".\backend");
process.StartInfo.WorkingDirectory = _pythonService.BackendDirectory;
process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
process.StartInfo.StandardErrorEncoding = Encoding.UTF8;

Expand Down Expand Up @@ -1010,6 +1010,7 @@ public async Task<string[]> InstallUpdatePythonDependencies()
process.StartInfo.CreateNoWindow = true;
process.StartInfo.StandardOutputEncoding = Encoding.UTF8;
process.StartInfo.StandardErrorEncoding = Encoding.UTF8;
process.StartInfo.WorkingDirectory = _pythonService.BackendDirectory;

var result = string.Empty;

Expand Down

0 comments on commit b59ea4e

Please sign in to comment.