Getting ModuleNotFoundError even though using await micropip.install #12

Closed
opened 2026-02-16 08:18:53 -05:00 by yindo · 1 comment
Owner

Originally created by @pratkolhe on GitHub (May 27, 2025).

I am getting the below error:

ModuleNotFoundError: No module named 'numpy'
The module 'numpy' is included in the Pyodide distribution, but it is not installed
You can install it by calling: await micropip.install("numpy") in Python, or await pyodide.loadPackage("numpy")

Even though the code installs this package using await micropip.install("numpy")

import micropip
await micropip.install("numpy")

import asyncio
await asyncio.sleep(0)

import numpy as np
array_1d = np.array([1, 2, 3, 4, 5])

# Calculate the mean of the array
mean_value = np.mean(array_1d)

mean_value
Originally created by @pratkolhe on GitHub (May 27, 2025). I am getting the below error: > ModuleNotFoundError: No module named 'numpy' > The module 'numpy' is included in the Pyodide distribution, but it is not installed > You can install it by calling: await micropip.install("numpy") in Python, or await pyodide.loadPackage("numpy") Even though the code installs this package using await micropip.install("numpy") ``` python import micropip await micropip.install("numpy") import asyncio await asyncio.sleep(0) import numpy as np array_1d = np.array([1, 2, 3, 4, 5]) # Calculate the mean of the array mean_value = np.mean(array_1d) mean_value ```
yindo closed this issue 2026-02-16 08:18:53 -05:00
Author
Owner

@pratkolhe commented on GitHub (May 28, 2025):

My bad, I was unknowingly using allow_net=False. On using allow_net=True this issue resolved.

@pratkolhe commented on GitHub (May 28, 2025): My bad, I was unknowingly using `allow_net=False`. On using `allow_net=True` this issue resolved.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langchain-sandbox#12