jupyter-dash
jupyter-dash copied to clipboard
app.run_server(mode="jupyterlab") does not open new tab for me
Hi,
First of all, thank you so much for making this great feature available.
I tried to follow your demo* from end to end, but this command line "app.run_server(mode="jupyterlab")" does not open any new tab for me; yet jupyter ran through.
May I know how to solve this?
*https://medium.com/plotly/introducing-jupyterdash-811f1f57c02e
-------------- jupyter version -------------- jupyter core : 4.5.0 jupyter-notebook : 6.0.1 qtconsole : 4.5.5 ipython : 7.8.0 ipykernel : 5.1.2 jupyter client : 5.3.3 jupyter lab : 2.2.9 nbconvert : 5.6.0 ipywidgets : 7.5.1 nbformat : 4.4.0 traitlets : 4.3.3
Thank you for your time in advance, Bill
Second this issue.
When run app.run_server(mode="jupyterlab") , got run_simple() got an unexpected keyword argument 'mode'.
I have tried to resolve this using Jupyter lab build beforehand, didn't notice anything that has changed (after the rebuild my Jupyter now is Jupyter 2.x. ).
Any Proposal that one may solve this?
Hi Tiansu,
I am very new to Github platform to prompt questions and exchange knowledge, just wanna let you know your message direct to me as well, while I can't see your question prompted on their issue's page.
Cheers, Bill
On Sat, Nov 21, 2020 at 7:20 PM Tiansu [email protected] wrote:
Second this issue.
When run app.run_server(mode="jupyterlab") , got run_simple() got an unexpected keyword argument 'mode'.
I have tried to resolve this using Jupyter lab build beforehand, didn't notice anything that has changed (after the rebuild my Jupyter now is Jupyter 2.x. ).
Any Proposal that one may solve this?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/plotly/jupyter-dash/issues/43#issuecomment-731565228, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQLS6WSORPB2XXHLFCOTAULSQ6PA5ANCNFSM4TS33DVQ .
+1
I run into this from time to time where jupyter runs the command without error but nothing happens. Usually this process gets it working again for me:
- Clear browser cookies
- Reload the page
- Restart the kernel
- Run the code
i also got the same problem
Hi @Amir-Abi , so happen to come across your question. I guess what stop you from opening a new tab is due to extension, the following link should be able to fix your problem: https://stackoverflow.com/questions/52771328/plotly-chart-not-showing-in-jupyter-notebook/65478275#65478275 . Hope this helps.
I have the same problem, too. Minimal example:
from jupyter_dash import JupyterDash
import dash_html_components as html
app = JupyterDash(__name__)
app.layout = html.Div('Minimal')
app.run_server(mode='jupyterlab')
Does not open a new tab. Replacing the last line with app.run_server(mode='inline') does show the “Minimal” web page in the cell output below, as expected. jupyter labextension list returns
JupyterLab v3.0.12
jupyter-matplotlib v0.8.3 enabled OK
@jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
Other labextensions (built into JupyterLab)
app dir: /home/user/.venv/jupyter/share/jupyter/lab
jupyterlab-dash v0.4.0 enabled OK
jupyterlab-plotly v4.14.3 enabled OK
plotlywidget v4.14.3 enabled OK
Did I miss something? Trying the steps you suggested @chadaeschliman did not help, sadly.
Hi @claudio-ebel , so happen to come across your question and a similar problem I assume.
There are several ways to test out for fixing your problem:
-
"Clear / clean up" the browser as mentioned above (if failed),
-
Reinstall the labextesion particularly for plotly (both require and optional), which can follow the steps provided in this link: https://stackoverflow.com/questions/52771328/plotly-chart-not-showing-in-jupyter-notebook/65478275#65478275 or https://plotly.com/python/getting-started/#jupyterlab-support
I solved my issue via option 2, since then I dont bump into any issues till now.
Hi @kplai2020,
first of all: Thank you very much for your answer.
To put it frankly, I have the strong impression you haven't even read my comment.
- The minimal example I provided does not even use
plotly, so how should reinstalling theplotlycomponents solve that issue?! - Also, the output of
jupyter labextension listshowed that I did have installed all the components, includingjupyterlab-plotyandplotlywidget.
Anyway, I cleared the browser cache (your solution 1), deinstalled all extensions, updated all python packages
$ jupyter labextension list
JupyterLab v3.0.13
/home/user/.venv/jupyter/share/jupyter/labextensions
jupyter-matplotlib v0.9.0 enabled OK
@jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
Other labextensions (built into JupyterLab)
app dir: /home/user/.venv/jupyter/share/jupyter/lab
Uninstalled core extensions:
jupyterlab-dash
jupyterlab-plotly
plotlywidget
reinstalled and enabled the extensions
JupyterLab v3.0.13
/home/user/.venv/jupyter/share/jupyter/labextensions
jupyter-matplotlib v0.9.0 enabled OK
@jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
Other labextensions (built into JupyterLab)
app dir: /home/user/.venv/jupyter/share/jupyter/lab
jupyterlab-dash v0.4.0 enabled OK
jupyterlab-plotly v4.14.3 enabled OK
plotlywidget v4.14.3 enabled OK
Uninstalled core extensions:
jupyterlab-dash
jupyterlab-plotly
plotlywidget
(your solution 2) and tried the minimal example with mode='jupyterlab in a freshly started kernel again, in Firefox as well as in Chromium.
The issue still exists, no new tab is opened.
Update!
Since no debug messages were emitted by jupyter-dash, I installed a development environment using the steps described here. There, the opening of the tab worked!!
So I started with a new virtual environment, and now mode='jupyterlab' does open a new tab 😀
For anyone to “reproduce” (please change paths according to your needs):
python -m venv ~/.venv/dash
source ~/.venv/dash/bin/activate
python -m pip install --upgrade pip
pip install jupyter-dash
pip install jupyterlab
jupyter-lab
Then, immediately a pop-up appears, asking you to rebuild jupyter. After confirming, waiting for the build to end and reload, the minimal example above opens a new tab.
After pip install pandas, also the example given in the JupyterDash announcement works with app.run_server(mode='jupyterlab'), so even plotly works now 👍
@claudio-ebel Sorry, I've just seen your messages. Good that you managed to solve your problem. I pointed you to plotly as JupyterDash is part of plotly and I shared you what I experienced and based on the shared info previously. Anyway, have a good weekend.
@TiansuYu I think that problem may be that in setting up the app you're using the original dash.Dash() class and not juypter_dash.JupyterDash() in setting up your app. Themode keyword isn't in the original dash so it's getting passed as an argument to Flask which doesn't understand it.
@astrowonk Thanks for the prompt. That may well be the key to the issue. But sadly I have moved away from Dash, therefore wont be able to follow the updates here any more. But hope my followed-up comment here could spark some further discussion and improvements. Cheers.
Hello, I am surprised this issue is still happening :(
The mode jupyterlab doesn't open a new tab, and inline works, but gives errors:

For some reason, even when the Graph has any other ID, the callback still expects to find a Graph with the default ID live-update-graph. The interesting part is that the callback actually works, but it's like if it executed twice, first with the right ID, and second with the default ID (this is when It fails).
I used as a sample the example from https://medium.com/plotly/introducing-jupyterdash-811f1f57c02e :
import plotly.express as px
from jupyter_dash import JupyterDash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output# Load Data
df = px.data.tips()# Build App
app = JupyterDash(__name__)
app.layout = html.Div([
html.H1("JupyterDash Demo"),
dcc.Graph(id='graph'),
html.Label([
"colorscale",
dcc.Dropdown(
id='colorscale-dropdown', clearable=False,
value='plasma', options=[
{'label': c, 'value': c}
for c in px.colors.named_colorscales()
])
]),
])# Define callback to update graph
@app.callback(
Output('graph', 'figure'),
[Input("colorscale-dropdown", "value")]
)
def update_figure(colorscale):
return px.scatter(
df, x="total_bill", y="tip", color="size",
color_continuous_scale=colorscale,
render_mode="webgl", title="Tips"
)# Run app and display result inline in the notebook
app.run_server(mode='inline')
I don't think that installing a development version is the right way neither.
Is this project still maintained? Last commit is from January and doesn't seem to be in active development.
Thanks! 👌🏻
Marc 
Hi, with the example code on Dash, both mode inline and external work, but mode jupyterlab doesnt work. I used JupyterDash class:
from jupyter_dash import JupyterDash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
from dash.dependencies import Input, Output
app = JupyterDash(__name__)
df = pd.DataFrame({
"Fruit": ["Apples", "Oranges", "Bananas", "Apples", "Oranges", "Bananas"],
"Amount": [4, 1, 2, 2, 4, 5],
"City": ["SF", "SF", "SF", "Montreal", "Montreal", "Montreal"]
})
fig = px.bar(df, x="Fruit", y="Amount", color="City", barmode="group")
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for your data.
'''),
dcc.Graph(
id='example-graph',
figure=fig
)
])
app.run_server(mode='jupyterlab')
Also, I have the extensions enabled:
JupyterLab v3.0.14
/home/hong/anaconda3/share/jupyter/labextensions
jupyterlab-plotly v5.5.0 enabled OK
@jupyter-widgets/jupyterlab-manager v3.0.0 enabled OK (python, jupyterlab_widgets)
Other labextensions (built into JupyterLab)
app dir: /home/hong/anaconda3/share/jupyter/lab
jupyterlab-dash v0.4.0 enabled OK
I'm new to dash and need help to start this learning journey. Thanks!
What you may have to do is upgrade your jupyter dash to a higher version then run
jupyter lab build
which will take an extremely long time but after that the jupyterlab mode worked for me.
+1. It doesn't show up for us as well. Does anyone know where is the error / log located for this that I can check? Thanks.
With the latest release the function run_server() is deprecated with run() and this function doesn't even have a mode argument.
I created an environment in anaconda with python 3.6.
conda create --name jupyterdash python=3.6
Then,
pip install jupyter-dash
pip install jupyterlab==3.0
pip install pandas
conda install nodejs=16.16
And, jupyter lab build.
These work totally just fine for me. Just use python, jupyterlab, and nodejs packages at the time ~Jan 2021.
Lastly, when the run_server(mode="jupyterlab") is executed, you need to restart the jupyterlab in order to reset the flask app.