Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fomightez/0482481cf0a9741b78fc9c3f0a0e9a23 to your computer and use it in GitHub Desktop.
Save fomightez/0482481cf0a9741b78fc9c3f0a0e9a23 to your computer and use it in GitHub Desktop.
Trying to see if Plotly Dash will work in JupyterLite since Plotly plots work well and the package does seem to install and run fine
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"kernelspec": {
"name": "python",
"display_name": "Python (Pyodide)",
"language": "python"
},
"language_info": {
"codemirror_mode": {
"name": "python",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8"
}
},
"nbformat_minor": 4,
"nbformat": 4,
"cells": [
{
"cell_type": "markdown",
"source": "## Can Plotly Dash work in JupyterLite?\n\nHad it working on MyBinder with full Python kernel, see [here](https://discourse.jupyter.org/t/dash-app-unresponsive-on-binder/27155/5?u=fomightez), but is it working in JupyterLite yet since OP there had complex notebook & file structure that would be a pain to refactor.\n\nSO FAR: **None of this below works to show the app.** The code runs but a lot of stuff is unsupported in JupyterLite it seems. Or I don't know the magic incantation yet?!?!",
"metadata": {}
},
{
"cell_type": "code",
"source": "%pip install -q dash dash-canvas",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": 9
},
{
"cell_type": "code",
"source": "# Based on https://dash.plotly.com/minimal-app ,trying to port it over to JupyterLite\nfrom dash import Dash, html, dcc, callback, Output, Input\nimport plotly.express as px\nimport pandas as pd\n\n#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')\n# Make that above line work in JupyterLite\nfrom pyodide.http import open_url\ndf = pd.read_csv(open_url('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv'))\napp = Dash()\n\napp.layout = [\n html.H1(children='Title of Dash App', style={'textAlign':'center'}),\n dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),\n dcc.Graph(id='graph-content')\n]\n\n@callback(\n Output('graph-content', 'figure'),\n Input('dropdown-selection', 'value')\n)\ndef update_graph(value):\n dff = df[df.country==value]\n return px.line(dff, x='year', y='pop')\n\nif __name__ == \"__main__\":\n app.run(debug=True)",
"metadata": {
"trusted": true
},
"outputs": [
{
"ename": "<class 'RuntimeError'>",
"evalue": "can't start new thread",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[18], line 27\u001b[0m\n\u001b[1;32m 24\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m px\u001b[38;5;241m.\u001b[39mline(dff, x\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124myear\u001b[39m\u001b[38;5;124m'\u001b[39m, y\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpop\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 26\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;18m__name__\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m__main__\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n\u001b[0;32m---> 27\u001b[0m \u001b[43mapp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdebug\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/dash/dash.py:2099\u001b[0m, in \u001b[0;36mDash.run\u001b[0;34m(self, host, port, proxy, debug, jupyter_mode, jupyter_width, jupyter_height, jupyter_server_url, 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)\u001b[0m\n\u001b[1;32m 2096\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m debug \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 2097\u001b[0m debug \u001b[38;5;241m=\u001b[39m get_combined_config(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdebug\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m-> 2099\u001b[0m debug \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menable_dev_tools\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2100\u001b[0m \u001b[43m \u001b[49m\u001b[43mdebug\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2101\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_ui\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2102\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_props_check\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2103\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_serve_dev_bundles\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2104\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2105\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload_interval\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2106\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload_watch_interval\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2107\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload_max_retry\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2108\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_silence_routes_logging\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2109\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_prune_errors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2110\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2112\u001b[0m \u001b[38;5;66;03m# Verify port value\u001b[39;00m\n\u001b[1;32m 2113\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
"File \u001b[0;32m/lib/python3.12/site-packages/dash/dash.py:1865\u001b[0m, in \u001b[0;36mDash.enable_dev_tools\u001b[0;34m(self, 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)\u001b[0m\n\u001b[1;32m 1857\u001b[0m _reload\u001b[38;5;241m.\u001b[39mwatch_thread \u001b[38;5;241m=\u001b[39m threading\u001b[38;5;241m.\u001b[39mThread(\n\u001b[1;32m 1858\u001b[0m target\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mlambda\u001b[39;00m: _watch\u001b[38;5;241m.\u001b[39mwatch(\n\u001b[1;32m 1859\u001b[0m [\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39massets_folder] \u001b[38;5;241m+\u001b[39m component_packages_dist,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1862\u001b[0m )\n\u001b[1;32m 1863\u001b[0m )\n\u001b[1;32m 1864\u001b[0m _reload\u001b[38;5;241m.\u001b[39mwatch_thread\u001b[38;5;241m.\u001b[39mdaemon \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m-> 1865\u001b[0m \u001b[43m_reload\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwatch_thread\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1867\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m debug:\n\u001b[1;32m 1868\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m jupyter_dash\u001b[38;5;241m.\u001b[39mactive:\n",
"File \u001b[0;32m/lib/python312.zip/threading.py:992\u001b[0m, in \u001b[0;36mThread.start\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 990\u001b[0m _limbo[\u001b[38;5;28mself\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\n\u001b[1;32m 991\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 992\u001b[0m \u001b[43m_start_new_thread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_bootstrap\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 993\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[1;32m 994\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m _active_limbo_lock:\n",
"\u001b[0;31mRuntimeError\u001b[0m: can't start new thread"
],
"output_type": "error"
}
],
"execution_count": 18
},
{
"cell_type": "markdown",
"source": "Dang. Result: `RuntimeError: can't start new thread`",
"metadata": {}
},
{
"cell_type": "code",
"source": "df.head()",
"metadata": {
"trusted": true
},
"outputs": [
{
"execution_count": 19,
"output_type": "execute_result",
"data": {
"text/plain": " country continent year lifeExp pop gdpPercap\n0 Afghanistan Asia 1952 28.801 8425333 779.445314\n1 Afghanistan Asia 1957 30.332 9240934 820.853030\n2 Afghanistan Asia 1962 31.997 10267083 853.100710\n3 Afghanistan Asia 1967 34.020 11537966 836.197138\n4 Afghanistan Asia 1972 36.088 13079460 739.981106",
"text/html": "<div>\n<style scoped>\n .dataframe tbody tr th:only-of-type {\n vertical-align: middle;\n }\n\n .dataframe tbody tr th {\n vertical-align: top;\n }\n\n .dataframe thead th {\n text-align: right;\n }\n</style>\n<table border=\"1\" class=\"dataframe\">\n <thead>\n <tr style=\"text-align: right;\">\n <th></th>\n <th>country</th>\n <th>continent</th>\n <th>year</th>\n <th>lifeExp</th>\n <th>pop</th>\n <th>gdpPercap</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>Afghanistan</td>\n <td>Asia</td>\n <td>1952</td>\n <td>28.801</td>\n <td>8425333</td>\n <td>779.445314</td>\n </tr>\n <tr>\n <th>1</th>\n <td>Afghanistan</td>\n <td>Asia</td>\n <td>1957</td>\n <td>30.332</td>\n <td>9240934</td>\n <td>820.853030</td>\n </tr>\n <tr>\n <th>2</th>\n <td>Afghanistan</td>\n <td>Asia</td>\n <td>1962</td>\n <td>31.997</td>\n <td>10267083</td>\n <td>853.100710</td>\n </tr>\n <tr>\n <th>3</th>\n <td>Afghanistan</td>\n <td>Asia</td>\n <td>1967</td>\n <td>34.020</td>\n <td>11537966</td>\n <td>836.197138</td>\n </tr>\n <tr>\n <th>4</th>\n <td>Afghanistan</td>\n <td>Asia</td>\n <td>1972</td>\n <td>36.088</td>\n <td>13079460</td>\n <td>739.981106</td>\n </tr>\n </tbody>\n</table>\n</div>"
},
"metadata": {}
}
],
"execution_count": 19
},
{
"cell_type": "code",
"source": "# based on https://wasmdash.vercel.app/\nfrom dash import Dash, html\nfrom dash_canvas import DashCanvas\n\napp = Dash(__name__)\napp.config.suppress_callback_exceptions = True\n\napp.layout = html.Div([\n html.H5('Press down the left mouse button and draw inside the canvas'),\n DashCanvas(id='canvas_101')\n ])\n\n\nif __name__ == '__main__':\n app.run(debug=True)\n",
"metadata": {
"trusted": true
},
"outputs": [
{
"ename": "<class 'RuntimeError'>",
"evalue": "can't start new thread",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mRuntimeError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[10], line 15\u001b[0m\n\u001b[1;32m 8\u001b[0m app\u001b[38;5;241m.\u001b[39mlayout \u001b[38;5;241m=\u001b[39m html\u001b[38;5;241m.\u001b[39mDiv([\n\u001b[1;32m 9\u001b[0m html\u001b[38;5;241m.\u001b[39mH5(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mPress down the left mouse button and draw inside the canvas\u001b[39m\u001b[38;5;124m'\u001b[39m),\n\u001b[1;32m 10\u001b[0m DashCanvas(\u001b[38;5;28mid\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcanvas_101\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 11\u001b[0m ])\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;18m__name__\u001b[39m \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m__main__\u001b[39m\u001b[38;5;124m'\u001b[39m:\n\u001b[0;32m---> 15\u001b[0m \u001b[43mapp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdebug\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/dash/dash.py:2099\u001b[0m, in \u001b[0;36mDash.run\u001b[0;34m(self, host, port, proxy, debug, jupyter_mode, jupyter_width, jupyter_height, jupyter_server_url, 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)\u001b[0m\n\u001b[1;32m 2096\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m debug \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 2097\u001b[0m debug \u001b[38;5;241m=\u001b[39m get_combined_config(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdebug\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m-> 2099\u001b[0m debug \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43menable_dev_tools\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2100\u001b[0m \u001b[43m \u001b[49m\u001b[43mdebug\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2101\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_ui\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2102\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_props_check\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2103\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_serve_dev_bundles\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2104\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2105\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload_interval\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2106\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload_watch_interval\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2107\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_hot_reload_max_retry\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2108\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_silence_routes_logging\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2109\u001b[0m \u001b[43m \u001b[49m\u001b[43mdev_tools_prune_errors\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2110\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2112\u001b[0m \u001b[38;5;66;03m# Verify port value\u001b[39;00m\n\u001b[1;32m 2113\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n",
"File \u001b[0;32m/lib/python3.12/site-packages/dash/dash.py:1865\u001b[0m, in \u001b[0;36mDash.enable_dev_tools\u001b[0;34m(self, 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)\u001b[0m\n\u001b[1;32m 1857\u001b[0m _reload\u001b[38;5;241m.\u001b[39mwatch_thread \u001b[38;5;241m=\u001b[39m threading\u001b[38;5;241m.\u001b[39mThread(\n\u001b[1;32m 1858\u001b[0m target\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mlambda\u001b[39;00m: _watch\u001b[38;5;241m.\u001b[39mwatch(\n\u001b[1;32m 1859\u001b[0m [\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39massets_folder] \u001b[38;5;241m+\u001b[39m component_packages_dist,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1862\u001b[0m )\n\u001b[1;32m 1863\u001b[0m )\n\u001b[1;32m 1864\u001b[0m _reload\u001b[38;5;241m.\u001b[39mwatch_thread\u001b[38;5;241m.\u001b[39mdaemon \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m-> 1865\u001b[0m \u001b[43m_reload\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwatch_thread\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstart\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1867\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m debug:\n\u001b[1;32m 1868\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m jupyter_dash\u001b[38;5;241m.\u001b[39mactive:\n",
"File \u001b[0;32m/lib/python312.zip/threading.py:992\u001b[0m, in \u001b[0;36mThread.start\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 990\u001b[0m _limbo[\u001b[38;5;28mself\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\n\u001b[1;32m 991\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 992\u001b[0m \u001b[43m_start_new_thread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_bootstrap\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 993\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m:\n\u001b[1;32m 994\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m _active_limbo_lock:\n",
"\u001b[0;31mRuntimeError\u001b[0m: can't start new thread"
],
"output_type": "error"
}
],
"execution_count": 10
},
{
"cell_type": "markdown",
"source": "Same result: `RuntimeError: can't start new thread`",
"metadata": {}
},
{
"cell_type": "code",
"source": "# Based on https://dash.plotly.com/minimal-app ,trying to port it over to JupyterLite\nfrom dash import Dash, html, dcc, callback, Output, Input\nimport plotly.express as px\nimport pandas as pd\n\n#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')\n# Make that above line work in JupyterLite\nfrom pyodide.http import open_url\ndf = pd.read_csv(open_url('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv'))\napp = Dash()\n\napp.layout = [\n html.H1(children='Title of Dash App', style={'textAlign':'center'}),\n dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),\n dcc.Graph(id='graph-content')\n]\n\n@callback(\n Output('graph-content', 'figure'),\n Input('dropdown-selection', 'value')\n)\ndef update_graph(value):\n dff = df[df.country==value]\n return px.line(dff, x='year', y='pop')\n\napp.run(jupyter_mode=\"jupyterlab\")",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": "Result: `Not supported`",
"metadata": {}
},
{
"cell_type": "code",
"source": "# Based on https://dash.plotly.com/minimal-app ,trying to port it over to JupyterLite\nfrom dash import Dash, html, dcc, callback, Output, Input\nimport plotly.express as px\nimport pandas as pd\n\n#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')\n# Make that above line work in JupyterLite\nfrom pyodide.http import open_url\ndf = pd.read_csv(open_url('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv'))\napp = Dash()\n\napp.layout = [\n html.H1(children='Title of Dash App', style={'textAlign':'center'}),\n dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),\n dcc.Graph(id='graph-content')\n]\n\n@callback(\n Output('graph-content', 'figure'),\n Input('dropdown-selection', 'value')\n)\ndef update_graph(value):\n dff = df[df.country==value]\n return px.line(dff, x='year', y='pop')\n\napp.run_server()",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": "Result: `Not supported`",
"metadata": {}
},
{
"cell_type": "code",
"source": "# Based on https://dash.plotly.com/minimal-app ,trying to port it over to JupyterLite\nfrom dash import Dash, html, dcc, callback, Output, Input\nimport plotly.express as px\nimport pandas as pd\n\n#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')\n# Make that above line work in JupyterLite\nfrom pyodide.http import open_url\ndf = pd.read_csv(open_url('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv'))\napp = Dash()\n\napp.layout = [\n html.H1(children='Title of Dash App', style={'textAlign':'center'}),\n dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),\n dcc.Graph(id='graph-content')\n]\n\n@callback(\n Output('graph-content', 'figure'),\n Input('dropdown-selection', 'value')\n)\ndef update_graph(value):\n dff = df[df.country==value]\n return px.line(dff, x='year', y='pop')\n \napp.run(jupyter_mode=\"tab\")",
"metadata": {
"trusted": true
},
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
"source": "Result: `Not supported`",
"metadata": {}
},
{
"cell_type": "code",
"source": "# Based on https://dash.plotly.com/minimal-app ,trying to port it over to JupyterLite\nfrom dash import Dash, html, dcc, callback, Output, Input\nimport plotly.express as px\nimport pandas as pd\n\n#df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv')\n# Make that above line work in JupyterLite\nfrom pyodide.http import open_url\ndf = pd.read_csv(open_url('https://raw.githubusercontent.com/plotly/datasets/master/gapminder_unfiltered.csv'))\napp = Dash()\n\napp.layout = [\n html.H1(children='Title of Dash App', style={'textAlign':'center'}),\n dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),\n dcc.Graph(id='graph-content')\n]\n\n@callback(\n Output('graph-content', 'figure'),\n Input('dropdown-selection', 'value')\n)\ndef update_graph(value):\n dff = df[df.country==value]\n return px.line(dff, x='year', y='pop')\n\n#app.run(jupyter_mode=\"external\") # causes also 'Not supported'\napp.run(mode=\"inline\") \n",
"metadata": {
"trusted": true
},
"outputs": [
{
"name": "stderr",
"text": "Not supported\n",
"output_type": "stream"
},
{
"ename": "<class 'AttributeError'>",
"evalue": "'tuple' object has no attribute 'tb_frame'",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mOSError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m/lib/python3.12/site-packages/werkzeug/serving.py:751\u001b[0m, in \u001b[0;36mBaseWSGIServer.__init__\u001b[0;34m(self, host, port, app, handler, passthrough_errors, ssl_context, fd)\u001b[0m\n\u001b[1;32m 750\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mserver_bind()\n\u001b[0;32m--> 751\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mserver_activate\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 752\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mOSError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 753\u001b[0m \u001b[38;5;66;03m# Catch connection issues and show them without the traceback. Show\u001b[39;00m\n\u001b[1;32m 754\u001b[0m \u001b[38;5;66;03m# extra instructions for address not found, and for macOS.\u001b[39;00m\n",
"File \u001b[0;32m/lib/python312.zip/socketserver.py:482\u001b[0m, in \u001b[0;36mTCPServer.server_activate\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 477\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Called by constructor to activate the server.\u001b[39;00m\n\u001b[1;32m 478\u001b[0m \n\u001b[1;32m 479\u001b[0m \u001b[38;5;124;03mMay be overridden.\u001b[39;00m\n\u001b[1;32m 480\u001b[0m \n\u001b[1;32m 481\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m--> 482\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mlisten\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest_queue_size\u001b[49m\u001b[43m)\u001b[49m\n",
"\u001b[0;31mOSError\u001b[0m: [Errno 138] Not supported",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mSystemExit\u001b[0m Traceback (most recent call last)",
" \u001b[0;31m[... skipping hidden 1 frame]\u001b[0m\n",
"Cell \u001b[0;32mIn[17], line 27\u001b[0m\n\u001b[1;32m 26\u001b[0m \u001b[38;5;66;03m#app.run(mode=\"inline\")\u001b[39;00m\n\u001b[0;32m---> 27\u001b[0m \u001b[43mapp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[43mjupyter_mode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mexternal\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/dash/dash.py:2168\u001b[0m, in \u001b[0;36mDash.run\u001b[0;34m(self, host, port, proxy, debug, jupyter_mode, jupyter_width, jupyter_height, jupyter_server_url, 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)\u001b[0m\n\u001b[1;32m 2167\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m jupyter_dash\u001b[38;5;241m.\u001b[39mactive:\n\u001b[0;32m-> 2168\u001b[0m \u001b[43mjupyter_dash\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_app\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2169\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2170\u001b[0m \u001b[43m \u001b[49m\u001b[43mmode\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mjupyter_mode\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2171\u001b[0m \u001b[43m \u001b[49m\u001b[43mwidth\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mjupyter_width\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2172\u001b[0m \u001b[43m \u001b[49m\u001b[43mheight\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mjupyter_height\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2173\u001b[0m \u001b[43m \u001b[49m\u001b[43mhost\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2174\u001b[0m \u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2175\u001b[0m \u001b[43m \u001b[49m\u001b[43mserver_url\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mjupyter_server_url\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2176\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 2177\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n",
"File \u001b[0;32m/lib/python3.12/site-packages/dash/_jupyter.py:332\u001b[0m, in \u001b[0;36mJupyterDash.run_app\u001b[0;34m(self, app, mode, width, height, host, port, server_url)\u001b[0m\n\u001b[1;32m 330\u001b[0m err_q \u001b[38;5;241m=\u001b[39m queue\u001b[38;5;241m.\u001b[39mQueue()\n\u001b[0;32m--> 332\u001b[0m server \u001b[38;5;241m=\u001b[39m \u001b[43mmake_server\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mapp\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mserver\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mthreaded\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mprocesses\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 333\u001b[0m logging\u001b[38;5;241m.\u001b[39mgetLogger(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwerkzeug\u001b[39m\u001b[38;5;124m\"\u001b[39m)\u001b[38;5;241m.\u001b[39msetLevel(logging\u001b[38;5;241m.\u001b[39mERROR)\n",
"File \u001b[0;32m/lib/python3.12/site-packages/werkzeug/serving.py:921\u001b[0m, in \u001b[0;36mmake_server\u001b[0;34m(host, port, app, threaded, processes, request_handler, passthrough_errors, ssl_context, fd)\u001b[0m\n\u001b[1;32m 920\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m threaded:\n\u001b[0;32m--> 921\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mThreadedWSGIServer\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 922\u001b[0m \u001b[43m \u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mapp\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrequest_handler\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpassthrough_errors\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mssl_context\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfd\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfd\u001b[49m\n\u001b[1;32m 923\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 925\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m processes \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m1\u001b[39m:\n",
"File \u001b[0;32m/lib/python3.12/site-packages/werkzeug/serving.py:773\u001b[0m, in \u001b[0;36mBaseWSGIServer.__init__\u001b[0;34m(self, host, port, app, handler, passthrough_errors, ssl_context, fd)\u001b[0m\n\u001b[1;32m 767\u001b[0m \u001b[38;5;28mprint\u001b[39m(\n\u001b[1;32m 768\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mOn macOS, try disabling the \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mAirPlay Receiver\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m service\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 769\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m from System Preferences -> General -> AirDrop & Handoff.\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 770\u001b[0m file\u001b[38;5;241m=\u001b[39msys\u001b[38;5;241m.\u001b[39mstderr,\n\u001b[1;32m 771\u001b[0m )\n\u001b[0;32m--> 773\u001b[0m \u001b[43msys\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexit\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 774\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mBaseException\u001b[39;00m:\n",
"\u001b[0;31mSystemExit\u001b[0m: 1",
"\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
" \u001b[0;31m[... skipping hidden 1 frame]\u001b[0m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/interactiveshell.py:2145\u001b[0m, in \u001b[0;36mInteractiveShell.showtraceback\u001b[0;34m(self, exc_tuple, filename, tb_offset, exception_only, running_compiled_code)\u001b[0m\n\u001b[1;32m 2142\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m exception_only:\n\u001b[1;32m 2143\u001b[0m stb \u001b[38;5;241m=\u001b[39m [\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mAn exception has occurred, use \u001b[39m\u001b[38;5;124m%\u001b[39m\u001b[38;5;124mtb to see \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 2144\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mthe full traceback.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m]\n\u001b[0;32m-> 2145\u001b[0m stb\u001b[38;5;241m.\u001b[39mextend(\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mInteractiveTB\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_exception_only\u001b[49m\u001b[43m(\u001b[49m\u001b[43metype\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 2146\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m)\n\u001b[1;32m 2147\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 2149\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcontains_exceptiongroup\u001b[39m(val):\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/ultratb.py:710\u001b[0m, in \u001b[0;36mListTB.get_exception_only\u001b[0;34m(self, etype, value)\u001b[0m\n\u001b[1;32m 702\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget_exception_only\u001b[39m(\u001b[38;5;28mself\u001b[39m, etype, value):\n\u001b[1;32m 703\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Only print the exception type and message, without a traceback.\u001b[39;00m\n\u001b[1;32m 704\u001b[0m \n\u001b[1;32m 705\u001b[0m \u001b[38;5;124;03m Parameters\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 708\u001b[0m \u001b[38;5;124;03m value : exception value\u001b[39;00m\n\u001b[1;32m 709\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 710\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mListTB\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstructured_traceback\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43metype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/ultratb.py:568\u001b[0m, in \u001b[0;36mListTB.structured_traceback\u001b[0;34m(self, etype, evalue, etb, tb_offset, context)\u001b[0m\n\u001b[1;32m 565\u001b[0m chained_exc_ids\u001b[38;5;241m.\u001b[39madd(\u001b[38;5;28mid\u001b[39m(exception[\u001b[38;5;241m1\u001b[39m]))\n\u001b[1;32m 566\u001b[0m chained_exceptions_tb_offset \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n\u001b[1;32m 567\u001b[0m out_list \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m--> 568\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstructured_traceback\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 569\u001b[0m \u001b[43m \u001b[49m\u001b[43metype\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 570\u001b[0m \u001b[43m \u001b[49m\u001b[43mevalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 571\u001b[0m \u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43metb\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mchained_exc_ids\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# type: ignore\u001b[39;49;00m\n\u001b[1;32m 572\u001b[0m \u001b[43m \u001b[49m\u001b[43mchained_exceptions_tb_offset\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 573\u001b[0m \u001b[43m \u001b[49m\u001b[43mcontext\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 574\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 575\u001b[0m \u001b[38;5;241m+\u001b[39m chained_exception_message\n\u001b[1;32m 576\u001b[0m \u001b[38;5;241m+\u001b[39m out_list)\n\u001b[1;32m 578\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m out_list\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/ultratb.py:1454\u001b[0m, in \u001b[0;36mAutoFormattedTB.structured_traceback\u001b[0;34m(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)\u001b[0m\n\u001b[1;32m 1452\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1453\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtb \u001b[38;5;241m=\u001b[39m etb\n\u001b[0;32m-> 1454\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mFormattedTB\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstructured_traceback\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1455\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43metype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mevalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43metb\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtb_offset\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumber_of_lines_of_context\u001b[49m\n\u001b[1;32m 1456\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/ultratb.py:1345\u001b[0m, in \u001b[0;36mFormattedTB.structured_traceback\u001b[0;34m(self, etype, value, tb, tb_offset, number_of_lines_of_context)\u001b[0m\n\u001b[1;32m 1342\u001b[0m mode \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmode\n\u001b[1;32m 1343\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m mode \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mverbose_modes:\n\u001b[1;32m 1344\u001b[0m \u001b[38;5;66;03m# Verbose modes need a full traceback\u001b[39;00m\n\u001b[0;32m-> 1345\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mVerboseTB\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mstructured_traceback\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1346\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43metype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtb\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtb_offset\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumber_of_lines_of_context\u001b[49m\n\u001b[1;32m 1347\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1348\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m mode \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mMinimal\u001b[39m\u001b[38;5;124m'\u001b[39m:\n\u001b[1;32m 1349\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ListTB\u001b[38;5;241m.\u001b[39mget_exception_only(\u001b[38;5;28mself\u001b[39m, etype, value)\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/ultratb.py:1192\u001b[0m, in \u001b[0;36mVerboseTB.structured_traceback\u001b[0;34m(self, etype, evalue, etb, tb_offset, number_of_lines_of_context)\u001b[0m\n\u001b[1;32m 1183\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mstructured_traceback\u001b[39m(\n\u001b[1;32m 1184\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1185\u001b[0m etype: \u001b[38;5;28mtype\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 1189\u001b[0m number_of_lines_of_context: \u001b[38;5;28mint\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m5\u001b[39m,\n\u001b[1;32m 1190\u001b[0m ):\n\u001b[1;32m 1191\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Return a nice text document describing the traceback.\"\"\"\u001b[39;00m\n\u001b[0;32m-> 1192\u001b[0m formatted_exception \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mformat_exception_as_a_whole\u001b[49m\u001b[43m(\u001b[49m\u001b[43metype\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mevalue\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43metb\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumber_of_lines_of_context\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1193\u001b[0m \u001b[43m \u001b[49m\u001b[43mtb_offset\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1195\u001b[0m colors \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mColors \u001b[38;5;66;03m# just a shorthand + quicker name lookup\u001b[39;00m\n\u001b[1;32m 1196\u001b[0m colorsnormal \u001b[38;5;241m=\u001b[39m colors\u001b[38;5;241m.\u001b[39mNormal \u001b[38;5;66;03m# used a lot\u001b[39;00m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/ultratb.py:1082\u001b[0m, in \u001b[0;36mVerboseTB.format_exception_as_a_whole\u001b[0;34m(self, etype, evalue, etb, number_of_lines_of_context, tb_offset)\u001b[0m\n\u001b[1;32m 1079\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(tb_offset, \u001b[38;5;28mint\u001b[39m)\n\u001b[1;32m 1080\u001b[0m head \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mprepare_header(\u001b[38;5;28mstr\u001b[39m(etype), \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlong_header)\n\u001b[1;32m 1081\u001b[0m records \u001b[38;5;241m=\u001b[39m (\n\u001b[0;32m-> 1082\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_records\u001b[49m\u001b[43m(\u001b[49m\u001b[43metb\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumber_of_lines_of_context\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtb_offset\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mif\u001b[39;00m etb \u001b[38;5;28;01melse\u001b[39;00m []\n\u001b[1;32m 1083\u001b[0m )\n\u001b[1;32m 1085\u001b[0m frames \u001b[38;5;241m=\u001b[39m []\n\u001b[1;32m 1086\u001b[0m skipped \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n",
"File \u001b[0;32m/lib/python3.12/site-packages/IPython/core/ultratb.py:1150\u001b[0m, in \u001b[0;36mVerboseTB.get_records\u001b[0;34m(self, etb, number_of_lines_of_context, tb_offset)\u001b[0m\n\u001b[1;32m 1148\u001b[0m \u001b[38;5;28;01mwhile\u001b[39;00m cf \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1149\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m-> 1150\u001b[0m mod \u001b[38;5;241m=\u001b[39m inspect\u001b[38;5;241m.\u001b[39mgetmodule(\u001b[43mcf\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtb_frame\u001b[49m)\n\u001b[1;32m 1151\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m mod \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1152\u001b[0m mod_name \u001b[38;5;241m=\u001b[39m mod\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\n",
"\u001b[0;31mAttributeError\u001b[0m: 'tuple' object has no attribute 'tb_frame'"
],
"output_type": "error"
}
],
"execution_count": 17
},
{
"cell_type": "markdown",
"source": "Result: `Not supported`",
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment