13 #ifndef QmitkSetupVirtualEnvUtil_h_Included
14 #define QmitkSetupVirtualEnvUtil_h_Included
29 using CallbackType = void (*)(itk::Object *,
const itk::EventObject &,
void *);
42 bool SetupVirtualEnv(
const QString &venvName,
43 const QStringList &packages,
44 std::function<
bool()> validator,
46 const QString &torchVersion =
"");
66 void PipInstall(
const std::string &library,
67 const std::string &workingDir,
69 const std::string &command =
"pip3");
78 void PipInstall(
const std::string &library,
CallbackType callback,
79 const std::string &command =
"pip3");
91 void ExecutePython(
const std::string &args,
92 const std::string &pythonPath,
94 const std::string &command =
"python");
104 void ExecutePython(
const std::string &args,
CallbackType callback,
105 const std::string &command =
"python");
116 void InstallPytorch(
const QString &workingDir,
CallbackType callback,
const QString &torchVersion =
"");
122 void InstallPytorch(
const QString& torchVersion =
"");
128 void InstallPytorch(
CallbackType callback,
const QString& torchVersion =
"");
136 QString& GetBaseDir();
143 QString& GetSystemPythonPath();
150 QString& GetPythonPath();
157 QString& GetPipPath();
164 void SetSystemPythonPath(
const QString& path);
171 void SetPythonPath(
const QString& path);
178 void SetPipPath(
const QString& path);
185 void SetVirtualEnvPath(
const QString &path);
194 bool IsPythonPath(
const QString &pythonPath);
200 static bool IsVenvInstalled(
const QString &pythonPath);
206 static QString GetPipPackageVersion(
const QString &pythonPath,
const QString &packageName);
213 static void PrintProcessEvent(itk::Object *,
const itk::EventObject &e,
void *);
220 static std::pair<QString, QString> GetExactPythonPath(
const QString &pyEnv);
226 static QStringList AutoParsePythonPaths();
229 QString m_PythonPath;
233 QString m_SysPythonPath;