[GH-ISSUE #5748] Problem loading Python Library when running the code on the sandbox - Asking for python 3.12 #84850

Closed
opened 2026-05-15 09:38:42 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @peuportier on GitHub (Sep 27, 2024).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/5748

Bug Report

Installation Method

Pip install under python 3.11

Environment

  • Open WebUI Version: [e.g., v0.3.30] ---> 0.3.30

  • Ollama (if applicable): [e.g., v0.2.0, v0.1.32-rc1] ---> 0.3.12

  • Operating System: [e.g., Windows 10, macOS Big Sur, Ubuntu 20.04] ---> MacOS X M1 -- Somona 14.1.1

  • Browser (if applicable): [e.g., Chrome 100.0, Firefox 98.0] --> Safari 17.4.1

Confirmation:

  • [x ] I have read and followed all the instructions provided in the README.md.
  • [ x] I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • [x ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

Expected that gave me the result or display what we asking for.
It only work for Mermaid or Matplolib

Screenshot 2024-09-27 at 12 57 12

Actual Behavior:

Problem to get the library or to call it

Screenshot 2024-09-27 at 12 52 26

Description

So when first I ask

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Data
np.random.seed(0)
data = np.random.rand(10, 12)

# Create heatmap chart
plt.figure(figsize=(10, 8))
sns.heatmap(data, annot=True, cmap="YlGnBu", fmt=".2f")

# Set title and labels
plt.title("Heatmap Chart")
plt.xlabel("Columns")
plt.ylabel("Rows")

# Show the plot
plt.show()

This no problem (Libraries likes numpy, matplotlib, seaborn) work fine. But when I need something more specific such as using Network X . I get the error.

If you want reproduce just asking:

Can you make me a mind map with fictional data?

it generate

import networkx as nx
import matplotlib.pyplot as plt

# Data
data = {
    "Central Idea": ["Idea 1", "Idea 2", "Idea 3"],
    "Idea 1": ["Sub Idea 1.1", "Sub Idea 1.2"],
    "Idea 2": ["Sub Idea 2.1", "Sub Idea 2.2", "Sub Idea 2.3"],
    "Idea 3": ["Sub Idea 3.1"],
    "Sub Idea 1.1": [],
    "Sub Idea 1.2": [],
    "Sub Idea 2.1": [],
    "Sub Idea 2.2": [],
    "Sub Idea 2.3": [],
    "Sub Idea 3.1": []
}

# Create directed graph
G = nx.DiGraph()

# Add nodes and edges
for node, children in data.items():
    G.add_node(node)
    for child in children:
        G.add_edge(node, child)

# Position nodes
pos = nx.spring_layout(G)

# Draw nodes
nx.draw_networkx_nodes(G, pos, node_size=5000, node_color="lightblue")

# Draw edges
nx.draw_networkx_edges(G, pos, width=2, edge_color="gray")

# Draw labels
nx.draw_networkx_labels(G, pos, font_size=12)

# Show the plot
plt.axis("off")
plt.show()

then when run the code

PythonError: Traceback (most recent call last): File "/lib/python312.zip/_pyodide/_base.py", line 502, in eval_code .run(globals, locals) ^^^^^^^^^^^^^^^^^^^^ File "/lib/python312.zip/_pyodide/_base.py", line 340, in run coroutine = eval(self.code, globals, locals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<exec>", line 1, in <module> ModuleNotFoundError: No module named 'networkx' The module 'networkx' is included in the Pyodide distribution, but it is not installed. You can install it by calling: await micropip.install("networkx") in Python, or await pyodide.loadPackage("networkx") in JavaScript See https://pyodide.org/en/stable/usage/loading-packages.html for more details.

Thanks you for your time, and guide me to a solution, if you have no time of course.

Originally created by @peuportier on GitHub (Sep 27, 2024). Original GitHub issue: https://github.com/open-webui/open-webui/issues/5748 # Bug Report ## Installation Method Pip install under python 3.11 ## Environment - **Open WebUI Version:** [e.g., v0.3.30] ---> 0.3.30 - **Ollama (if applicable):** [e.g., v0.2.0, v0.1.32-rc1] ---> 0.3.12 - **Operating System:** [e.g., Windows 10, macOS Big Sur, Ubuntu 20.04] ---> MacOS X M1 -- Somona 14.1.1 - **Browser (if applicable):** [e.g., Chrome 100.0, Firefox 98.0] --> Safari 17.4.1 **Confirmation:** - [x ] I have read and followed all the instructions provided in the README.md. - [ x] I am on the latest version of both Open WebUI and Ollama. - [ ] I have included the browser console logs. - [ ] I have included the Docker container logs. - [x ] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: Expected that gave me the result or display what we asking for. It only work for Mermaid or Matplolib <img width="1015" alt="Screenshot 2024-09-27 at 12 57 12" src="https://github.com/user-attachments/assets/00241cb2-2b73-4d7a-aad9-595a86749fd5"> ## Actual Behavior: Problem to get the library or to call it <img width="1076" alt="Screenshot 2024-09-27 at 12 52 26" src="https://github.com/user-attachments/assets/b9045209-ce91-4beb-96d4-70c1e116118f"> ## Description So when first I ask ``` import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Data np.random.seed(0) data = np.random.rand(10, 12) # Create heatmap chart plt.figure(figsize=(10, 8)) sns.heatmap(data, annot=True, cmap="YlGnBu", fmt=".2f") # Set title and labels plt.title("Heatmap Chart") plt.xlabel("Columns") plt.ylabel("Rows") # Show the plot plt.show() ``` This no problem (Libraries likes numpy, matplotlib, seaborn) work fine. But when I need something more specific such as using Network X . I get the error. If you want reproduce just asking: Can you make me a mind map with fictional data? it generate ``` import networkx as nx import matplotlib.pyplot as plt # Data data = { "Central Idea": ["Idea 1", "Idea 2", "Idea 3"], "Idea 1": ["Sub Idea 1.1", "Sub Idea 1.2"], "Idea 2": ["Sub Idea 2.1", "Sub Idea 2.2", "Sub Idea 2.3"], "Idea 3": ["Sub Idea 3.1"], "Sub Idea 1.1": [], "Sub Idea 1.2": [], "Sub Idea 2.1": [], "Sub Idea 2.2": [], "Sub Idea 2.3": [], "Sub Idea 3.1": [] } # Create directed graph G = nx.DiGraph() # Add nodes and edges for node, children in data.items(): G.add_node(node) for child in children: G.add_edge(node, child) # Position nodes pos = nx.spring_layout(G) # Draw nodes nx.draw_networkx_nodes(G, pos, node_size=5000, node_color="lightblue") # Draw edges nx.draw_networkx_edges(G, pos, width=2, edge_color="gray") # Draw labels nx.draw_networkx_labels(G, pos, font_size=12) # Show the plot plt.axis("off") plt.show() ``` then when run the code `PythonError: Traceback (most recent call last): File "/lib/python312.zip/_pyodide/_base.py", line 502, in eval_code .run(globals, locals) ^^^^^^^^^^^^^^^^^^^^ File "/lib/python312.zip/_pyodide/_base.py", line 340, in run coroutine = eval(self.code, globals, locals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "<exec>", line 1, in <module> ModuleNotFoundError: No module named 'networkx' The module 'networkx' is included in the Pyodide distribution, but it is not installed. You can install it by calling: await micropip.install("networkx") in Python, or await pyodide.loadPackage("networkx") in JavaScript See https://pyodide.org/en/stable/usage/loading-packages.html for more details.` Thanks you for your time, and guide me to a solution, if you have no time of course.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#84850