Issue
I am trying to make charts using JupyterDash but first things first... i can't run simple JupyterDash test via Jupyter Notebook because every time i receive the same error:
AttributeError: ('Read-only: can only be set in the Dash constructor or during init_app()', 'requests_pathname_prefix')
My code:
from jupyter_dash import JupyterDash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objs as go
import plotly.express as px
import dash
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = JupyterDash(__name__,external_stylesheets = external_stylesheets) #
app.layout= html.Div([html.H1("Hello world!!!"),
html.Div("This is the first paragraph"),
html.H1("Welcome back"),
html.Div("This is the second paragraph"),
html.Div(id="no_show",style= {'display':'none'}),
dcc.Graph(id = "graph",figure = go.Figure())],
style = {"text-align":"center"})
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
if __name__ =='__main__':
app.run_server(mode="external") #debug=True
I tried many different variations of app.run_serwer(....) and none works. Also tried to run this sample in JupyterLab with the same negative result. I have installed JupyterDash via:
pip install jupyter-dash
Any suggestions how to solve this problem?
Solution
The following piece of code helped me obtain an output, I hope it works for you too. It appears that the recent changes in Jupyter_dash are responsible for the breakage in functionality, I could be wrong though.
I am a newbie and your feedback if the code worked or didn't helps me learn too. I have attached a screenshot of the output I obtained using Google Colab.
Thanks in advance.
Please try this:
#Installing specific packages.
!pip install -q dash==1.19.0
!pip install -q jupyter_dash==0.3.0
#Importing the libraries.
from jupyter_dash import JupyterDash
import dash_html_components as html
import dash_core_components as dcc
import plotly.graph_objs as go
import plotly.express as px
import dash
from dash.dependencies import Input, Output
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = JupyterDash(__name__,external_stylesheets = external_stylesheets) #
app.layout= html.Div([html.H1("Hello world!!!"),
html.Div("This is the first paragraph"),
html.H1("Welcome back"),
html.Div("This is the second paragraph"),
html.Div(id="no_show",style= {'display':'none'}),
dcc.Graph(id = "graph",figure = go.Figure())],
style = {"text-align":"center"})
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
if __name__ =='__main__':
app.run_server(mode="external")
Answered By - Abhishek V
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.