MCPcopy Create free account
hub / github.com/6174/comflowyspace / installPythonTask

Function installPythonTask

apps/node/src/modules/comfyui/bootstrap.ts:183–214  ·  view source on GitHub ↗
(dispatcher: TaskEventDispatcher)

Source from the content-addressed store, hash-verified

181 * @returns
182 */
183export async function installPythonTask(dispatcher: TaskEventDispatcher): Promise<boolean> {
184 let success = false;
185 let lastError = null;
186 for (let i = 0; i < 3; i++) {
187 try {
188 if (await checkIfInstalled("python")) {
189 dispatcher({
190 message: `Already Find Python=3.10.8`
191 });
192 return true;
193 }
194 dispatcher({
195 message: `Start installing Python=3.10.8`
196 });
197 await runCommand(`conda create -c anaconda -n ${CONDA_ENV_NAME} python=3.10.8 -y`, dispatcher);
198
199 dispatcher({
200 message: `Install Python=3.10.8 finished`
201 });
202 conda.updateCondaInfo();
203 success = true;
204 break;
205 } catch (e: any) {
206 lastError = e;
207 }
208 }
209
210 if (!success) {
211 throw new Error(`Install python error: ${lastError.message}`);
212 }
213 return true;
214}
215
216/**
217 * install any conda package

Callers 1

ApiBootstrapFunction · 0.90

Calls 3

runCommandFunction · 0.90
checkIfInstalledFunction · 0.85
updateCondaInfoMethod · 0.80

Tested by

no test coverage detected