13 #ifndef QmitkSetupVirtualEnvUtil_h_Included
14 #define QmitkSetupVirtualEnvUtil_h_Included
28 using CallbackType = void (*)(itk::Object *,
const itk::EventObject &,
void *);
37 virtual bool SetupVirtualEnv(
const QString& venvName) = 0;
45 virtual QString GetVirtualEnvPath();
57 void PipInstall(
const std::string &library,
58 const std::string &workingDir,
60 const std::string &command =
"pip3");
69 void PipInstall(
const std::string &library,
CallbackType callback,
70 const std::string &command =
"pip3");
82 void ExecutePython(
const std::string &args,
83 const std::string &pythonPath,
85 const std::string &command =
"python");
95 void ExecutePython(
const std::string &args,
CallbackType callback,
96 const std::string &command =
"python");
106 void InstallPytorch(
const std::string &workingDir,
CallbackType callback);
112 void InstallPytorch();
126 QString& GetBaseDir();
133 QString& GetSystemPythonPath();
140 QString& GetPythonPath();
147 QString& GetPipPath();
154 void SetSystemPythonPath(
const QString& path);
161 void SetPythonPath(
const QString& path);
168 void SetPipPath(
const QString& path);
175 void SetVirtualEnvPath(
const QString &path);
184 bool IsPythonPath(
const QString &pythonPath);
190 static bool IsVenvInstalled(
const QString &pythonPath);
196 static QString GetPipPackageVersion(
const QString &pythonPath,
const QString &packageName);
203 static void PrintProcessEvent(itk::Object *,
const itk::EventObject &e,
void *);
210 static std::pair<QString, QString> GetExactPythonPath(
const QString &pyEnv);
213 QString m_PythonPath;
217 QString m_SysPythonPath;