Skip to content

Commit 84c38f7

Browse files
committed
fix: load micropip first in fallback mechanism
The fallback was failing because micropip itself wasn't loaded. Now we use pyodide.loadPackage() to load micropip first, then use it to install ipython.
1 parent 7625a16 commit 84c38f7

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/pyodide-runtime-agent/src/pyodide-worker.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,15 @@ async function setupIPythonEnvironment(): Promise<void> {
142142
});
143143

144144
try {
145-
// Use micropip to install IPython
145+
// First load micropip using pyodide.loadPackage
146+
self.postMessage({
147+
type: "log",
148+
data: "Loading micropip for fallback installation",
149+
});
150+
151+
await pyodide!.loadPackage(["micropip"]);
152+
153+
// Then use micropip to install IPython
146154
await pyodide!.runPythonAsync(`
147155
import micropip
148156
await micropip.install("ipython")

0 commit comments

Comments
 (0)