holzschu / Carnets

Carnets is a stand-alone Jupyter notebook server and client. Edit your notebooks on the go, even where there is no network.
https://holzschu.github.io/Carnets_Jupyter/
BSD 3-Clause "New" or "Revised" License
546 stars 31 forks source link

Dash related issue #289

Open ifuchs opened 1 year ago

ifuchs commented 1 year ago

I tried running this relatively simple Dash/Plotly example script: `from dash import Dash, dcc, html, Input, Output import plotly.graph_objects as go

app = Dash(name)

app.layout = html.Div([ html.H4('Interactive color selection with simple Dash example'), html.P("Select color:"), dcc.Dropdown( id="dropdown", options=['Gold', 'MediumTurquoise', 'LightGreen'], value='Gold', clearable=False, ), dcc.Graph(id="graph"), ])

@app.callback( Output("graph", "figure"), Input("dropdown", "value")) def display_color(color): fig = go.Figure( data=go.Bar(y=[2, 3, 1], # replace with your own data source marker_color=color)) return fig

app.run_server(debug=True) `

And got this door traceback:

`SystemExit Traceback (most recent call last) Cell In [16], line 30 24 fig = go.Figure( 25 data=go.Bar(y=[2, 3, 1], # replace with your own data source 26 marker_color=color)) 27 return fig ---> 30 app.run_server(debug=True)

File /var/mobile/Containers/Data/Application/7778AFF4-408E-4BA2-B883-208E7BD88E4F/Library/lib/python3.11/site-packages/dash/dash.py:2132, in Dash.run_server(self, *args, kwargs) 2126 def run_server(self, *args, *kwargs): 2127 """run_server is a deprecated alias of run and may be removed in a 2128 future version. We recommend using app.run instead. 2129 2130 See app.run for usage information. 2131 """ -> 2132 self.run(args, kwargs)

File /var/mobile/Containers/Data/Application/7778AFF4-408E-4BA2-B883-208E7BD88E4F/Library/lib/python3.11/site-packages/dash/dash.py:1979, in Dash.run(self, host, port, proxy, debug, dev_tools_ui, dev_tools_props_check, dev_tools_serve_dev_bundles, dev_tools_hot_reload, dev_tools_hot_reload_interval, dev_tools_hot_reload_watch_interval, dev_tools_hot_reload_max_retry, dev_tools_silence_routes_logging, dev_tools_prune_errors, flask_run_options) 1976 elif os.path.isfile(path): 1977 extra_files.append(path) -> 1979 self.server.run(host=host, port=port, debug=debug, flask_run_options)

File /var/mobile/Containers/Data/Application/7778AFF4-408E-4BA2-B883-208E7BD88E4F/Library/lib/python3.11/site-packages/flask/app.py:1191, in Flask.run(self, host, port, debug, load_dotenv, options) 1188 from werkzeug.serving import run_simple 1190 try: -> 1191 run_simple(t.cast(str, host), port, self, options) 1192 finally: 1193 # reset the first request information if the development server 1194 # reset normally. This makes it possible to restart the server 1195 # without reloader and that stuff from an interactive shell. 1196 self._got_first_request = False

File /var/mobile/Containers/Data/Application/7778AFF4-408E-4BA2-B883-208E7BD88E4F/Library/lib/python3.11/site-packages/werkzeug/serving.py:1059, in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, exclude_patterns, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context) 1056 from ._reloader import run_with_reloader 1058 try: -> 1059 run_with_reloader( 1060 srv.serve_forever, 1061 extra_files=extra_files, 1062 exclude_patterns=exclude_patterns, 1063 interval=reloader_interval, 1064 reloader_type=reloader_type, 1065 ) 1066 finally: 1067 srv.server_close()

File /var/mobile/Containers/Data/Application/7778AFF4-408E-4BA2-B883-208E7BD88E4F/Library/lib/python3.11/site-packages/werkzeug/_reloader.py:444, in run_with_reloader(main_func, extra_files, exclude_patterns, interval, reloader_type) 442 reloader.run() 443 else: --> 444 sys.exit(reloader.restart_with_reloader()) 445 except KeyboardInterrupt: 446 pass `

holzschu commented 1 year ago

While plotly works in Carnets (at least in the TestFlight version), I don't think that dash can work, at least not without modifications: it means running a different command (the app server) on top of the Jupyter server and client, and it probably does this by forking, which doesn't exist on iOS.

I'll have a look, but I don't expect a miracle.