Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: fix micropip patch (#4812)

Myles Scolnick8db8be3b22de
diff --git a/marimo/_output/formatters/formatters.py b/marimo/_output/formatters/formatters.py
index cac4f99527..dbdddd1f35 100644
--- a/marimo/_output/formatters/formatters.py
+++ b/marimo/_output/formatters/formatters.py
@@ -153,12 +153,7 @@ def register_formatters(theme: Theme = "light") -> None:
) -> Any:
del self
- try:
- spec = original_find_spec(fullname, path, target)
- except Exception as e:
- LOGGER.warning(f"Error finding spec for {fullname}: {e}")
- spec = None
-
+ spec = original_find_spec(fullname, path, target)
if spec is None:
return spec
diff --git a/marimo/_runtime/patches.py b/marimo/_runtime/patches.py
index bd3a92261b..0ef16b899a 100644
--- a/marimo/_runtime/patches.py
+++ b/marimo/_runtime/patches.py
@@ -72,13 +72,11 @@ def patch_micropip(glbls: dict[Any, Any]) -> None:
definitions = textwrap.dedent(
"""\
from importlib.abc import Loader, MetaPathFinder
+from importlib.util import spec_from_loader
class _MicropipFinder(MetaPathFinder):
-
def find_spec(self, fullname, path, target=None):
- from importlib.util import spec_from_loader
-
if fullname == 'micropip':
return spec_from_loader(fullname, _MicropipLoader())
return None