I'm trying to run all cells of jupyter notebook from command line. For that task, I have done:
jupyter nbconvert --inplace --execute myNotebook.ipynb.
The problem now is that my script contains some plots from Plotly library and then when I open the notebook again using jupyter's interface, plots are blanks. I have used many options like:
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode(connected=True)
%matplotlib inline
¿Anyone has any idea for this problem?
Thanks
I add part of my script in order to help you.
import pandas as pd
import plotly
from plotly.offline import init_notebook_mode, iplot
import plotly.graph_objects as go
from datetime import datetime
init_notebook_mode(connected=True)
df = pd.DataFrame({'one' : pd.Series([10, 20, 30, 40]),'two' : pd.Series([10, 20, 30, 40])})
fig = go.Figure()
fig.add_trace(go.Scatter(x=df.one,y=df.two))
fig.update_layout(xaxis_range=[min(df.one),max(df.one)])
iplot(fig)
print(datetime.now())
You can solve this problem with two step
Your notebook is not trusted issue exists with plotly so trust your notebook
jupyter trust myNotebook.ipynb
Now run your notebook from command line
jupyter nbconvert --inplace --execute myNotebook.ipynb.
You can also have a look at related
Here is my working notebook image

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With