|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Headless pip installer with structured progress reporting. More...
#include <QmitkPipInstaller.h>


Signals | |
| void | VirtualEnvCreationStarted () |
| Emitted when virtual environment creation starts. More... | |
| void | PipUpgradeStarted () |
| Emitted when the pip upgrade step starts. More... | |
| void | ResolveStarted () |
| Emitted when resolution of a group starts. More... | |
| void | PackageStatusChanged (int index, const QString &name, mitk::PackageStatus status) |
| Emitted when a package's installation status changes. More... | |
| void | PostInstallStepStarted (const QString &displayName) |
| Emitted when a post-install step starts. More... | |
| void | InstallFinished (bool success) |
| Emitted when the installation terminates. More... | |
| void | OutputReceived (const QString &text, bool isError) |
| Raw process output for display in a details view. More... | |
| void | ProgressChanged (int current, int total) |
| Per-package progress during the install phase only. More... | |
| void | ErrorOccurred (const QString &message) |
| Emitted on fatal errors (e.g. Python executable not found). More... | |
Public Member Functions | |
| QmitkPipInstaller (QObject *parent=nullptr) | |
| ~QmitkPipInstaller () override | |
| void | SetInstallSpec (const mitk::PipInstallSpec &spec) |
| Set the installation specification. More... | |
| void | StartInstall () |
| Start the installation. More... | |
| void | Cancel () |
| Cancel the current operation. More... | |
| void | AbandonInstall () |
| Tear down anything this installer created during a failed install. More... | |
| bool | IsRunning () const |
| Whether an operation is currently running. More... | |
| const std::vector< mitk::PipPackageInfo > & | GetResolvedPackages () const |
| The full list of resolved packages across all groups. More... | |
Headless pip installer with structured progress reporting.
Manages pip package installation as a two-phase process per install group:
pip install –dry-run –report to determine the full set of packages that would be installed.–no-deps for per-package status tracking.Install groups (PipInstallGroup) are processed sequentially. Each group can have its own index URL and pip arguments. This supports scenarios like installing PyTorch from a CUDA-specific index while installing other packages from the default PyPI.
All operations are asynchronous. Progress is communicated through Qt signals.
Definition at line 43 of file QmitkPipInstaller.h.
|
explicit |
|
override |
| void QmitkPipInstaller::AbandonInstall | ( | ) |
Tear down anything this installer created during a failed install.
Intended to be called by the consumer when it gives up after a failed install (e.g. the user dismisses the install dialog instead of retrying). If a venv was created by this installer and the last operation ended in the Failed state, the venv is removed.
Has no effect after a successful install (Done state) or while an operation is still running - in the latter case call Cancel() instead.
| void QmitkPipInstaller::Cancel | ( | ) |
Cancel the current operation.
Kills the running pip process and returns immediately. The terminal InstallFinished(false) signal is deferred until the killed process reports finished, at which point venv removal (if one was created) runs synchronously on the calling thread inside the finished slot. For a GUI consumer this means the event loop is briefly blocked by fs::remove_all; in practice this is fast but can stall on a slow disk or if an antivirus scanner holds a handle open.
|
signal |
Emitted on fatal errors (e.g. Python executable not found).
| const std::vector<mitk::PipPackageInfo>& QmitkPipInstaller::GetResolvedPackages | ( | ) | const |
The full list of resolved packages across all groups.
Grows as each group resolves: after ParseResolveReport emits the per-package Pending entries via PackageStatusChanged, those entries are present in this list. Fully populated before InstallFinished.
|
signal |
Emitted when the installation terminates.
Fires exactly once per StartInstall() call, covering both success and every failure mode (resolve failure, package install failure, a non-optional post-install step failure, setup errors).
Setup and failure messages arrive via ErrorOccurred before this signal; consumers that want to display a specific cause should use that signal (or accumulated OutputReceived) rather than relying on a per-phase Finished signal.
| [in] | success | True only if every package installed successfully and every non-optional model download succeeded. |
| bool QmitkPipInstaller::IsRunning | ( | ) | const |
Whether an operation is currently running.
|
signal |
Raw process output for display in a details view.
| [in] | text | The output text. |
| [in] | isError | True if the text came from stderr. |
|
signal |
Emitted when a package's installation status changes.
During resolve, fires once per resolved package with status Pending. During install, fires with status Installing, Installed, or Failed.
| [in] | index | Index into the resolved packages list. |
| [in] | name | The package name. |
| [in] | status | The new status. |
|
signal |
Emitted when the pip upgrade step starts.
|
signal |
Emitted when a post-install step starts.
Fired once per entry in PipInstallSpec::postInstallSteps, in order.
| [in] | displayName | The step's display name. |
|
signal |
Per-package progress during the install phase only.
Fires during the Installing state for each resolved package as the installer advances through the combined resolved list. Not emitted during virtual-env creation, pip upgrade, resolve, or model download - those phases are treated as indeterminate by the dialog.
| [in] | current | Number of packages finished so far in the install phase. |
| [in] | total | Total number of resolved packages across all groups. |
|
signal |
Emitted when resolution of a group starts.
| void QmitkPipInstaller::SetInstallSpec | ( | const mitk::PipInstallSpec & | spec | ) |
Set the installation specification.
Must be called before StartInstall(). Has no effect (and logs a warning) while an operation is running.
| void QmitkPipInstaller::StartInstall | ( | ) |
Start the installation.
For each install group in PipInstallSpec::groups, the engine first runs a pip install –dry-run –report to determine the full set of packages, then installs them one-by-one with –no-deps. Groups are processed sequentially so that the next group's resolve sees the previous group's packages already installed (essential for cases like a CUDA-specific PyTorch index).
Has no effect if an operation is already running.
|
signal |
Emitted when virtual environment creation starts.