Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plotly not available in native window #3928

Open
da-i opened this issue Oct 29, 2024 · 1 comment
Open

Plotly not available in native window #3928

da-i opened this issue Oct 29, 2024 · 1 comment
Labels
question Further information is requested

Comments

@da-i
Copy link

da-i commented Oct 29, 2024

Description

Using Ubuntu 24.04.1 LTS i tried to run a native test with the plotly update example, but got an error:

test.py:

import plotly.graph_objects as go
from nicegui import ui, native
from random import random

fig = go.Figure()
fig.update_layout(margin=dict(l=0, r=0, t=0, b=0))
plot = ui.plotly(fig).classes('w-full h-40')

def add_trace(fig,plot):
    fig.add_trace(go.Scatter(x=[1, 2, 3], y=[random(), random(), random()]))
    plot.update()

ui.button('Add trace', on_click= lambda: add_trace(fig,plot))

ui.run(
    favicon="🚀",
    title="Test plot",
    native=True,
    reload=False,
    port=native.find_open_port(),
    window_size=(1600, 1200),
    storage_secret="somesecret",
)

Setup simple env for test

>conda create -n UI_test3 -c conda-forge python=3.11
>conda activate UI_test3
>pip install "nicegui[plotly]"
Collecting nicegui[plotly]
  Downloading nicegui-2.5.0-py3-none-any.whl.metadata (10 kB)
.....
>pip install "pywebview[qt]"
....

When i run the example

> python test.py
NiceGUI ready to go on http://localhost:8000
[pywebview] GTK cannot be loaded
Traceback (most recent call last):
  File "/home/dami/anaconda3/envs/UI_test3/lib/python3.11/site-packages/webview/guilib.py", line 37, in import_gtk
    import webview.platforms.gtk as guilib
  File "/home/dami/anaconda3/envs/UI_test3/lib/python3.11/site-packages/webview/platforms/gtk.py", line 20, in <module>
    import gi
ModuleNotFoundError: No module named 'gi'
js: TypeError: Failed to resolve module specifier 'plotly'

Is this a known issue? I could not find much detail in the docs about this.

@rodja
Copy link
Member

rodja commented Oct 30, 2024

Does the same happen in a plain pywebview application without NiceGUI?

@falkoschindler falkoschindler added the question Further information is requested label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants