plotly.py
plotly.py copied to clipboard
ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed
ValueError Traceback (most recent call last) File d:\Files\Training\Python\Visualization Assignment\Startup-Data-Visualizer\venv\Lib\site-packages\IPython\core\formatters.py:922, in IPythonDisplayFormatter.call(self, obj) 920 method = get_real_method(obj, self.print_method) 921 if method is not None: --> 922 method() 923 return True
File d:\Files\Training\Python\Visualization Assignment\Startup-Data-Visualizer\venv\Lib\site-packages\plotly\basedatatypes.py:832, in BaseFigure.ipython_display(self) 829 import plotly.io as pio 831 if pio.renderers.render_on_display and pio.renderers.default: --> 832 pio.show(self) 833 else: 834 print(repr(self))
File d:\Files\Training\Python\Visualization Assignment\Startup-Data-Visualizer\venv\Lib\site-packages\plotly\io_renderers.py:394, in show(fig, renderer, validate, **kwargs) 389 raise ValueError( 390 "Mime type rendering requires ipython but it is not installed" 391 ) 393 if not nbformat or Version(nbformat.version) < Version("4.2.0"): --> 394 raise ValueError( 395 "Mime type rendering requires nbformat>=4.2.0 but it is not installed" 396 ) 398 ipython_display.display(bundle, raw=True) 400 # external renderers
ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed
Plotly is plotting the plot. But it also is showing the above warning.
I tried https://stackoverflow.com/questions/66557543/valueerror-mime-type-rendering-requires-nbformat-4-2-0-but-it-is-not-installed, but no luck.
hi @NotShrirang Thanks for reporting this. I see you used this code below. Can you please share your data with us so we can replicate the error locally?
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import plotly.express as px
df = df[df['Data']>0]
df['Timestamp'] = pd.to_datetime(df['Timestamp'])
df = df[(df['Id'] ==1)|(df['Id'] ==6)]
dfp = pd.pivot_table(df,
values='Data',
index=['Timestamp'],
columns=['Id'],
)
nrows = len(dfp.columns)
fig = make_subplots(rows=nrows,
cols=1,
subplot_titles=['Id '+str(c) for c in dfp.columns])
# add traces
x = 1
for i, col in enumerate(dfp.columns):
fig.add_trace(go.Scatter(x=dfp.index, y=dfp[col].values,
name = 'Id '+str(col),
mode = 'lines',
),
row=i+1,
col=1)
fig.update_layout(height=nrows*500)
fig.show()
Hi,
I have exactly the same error. Plese find the simple code below to reproduce it:
# generate a simple 3D graph
import plotly.graph_objects as go
import numpy as np
vec1 = np.array([1, 2, 3])
vec2 = np.array([2, 3, 4])
vec3 = np.cross(vec1, vec2)
# plot the vectors in 3D
fig = go.Figure(data=[
go.Scatter3d(x=[0, vec1[0]], y=[0, vec1[1]], z=[0, vec1[2]], marker=dict(size=[5, 12], color='blue')),
go.Scatter3d(x=[0, vec2[0]], y=[0, vec2[1]], z=[0, vec2[2]], marker=dict(size=[5, 12], color='red')),
go.Scatter3d(x=[0, vec3[0]], y=[0, vec3[1]], z=[0, vec3[2]], marker=dict(size=[5, 12], color='green'))
])
fig.show()
Attention! I was not able to run on version 5.19, so I installed the version 5.18. It worked, but then I wanted to reproduce the error for you, so I reinstalled the 5.19 and it keeps on working. Maybe there are some depencencies missing in pip package of 5.19?
Hope it helps you to solve the issue!
Thank you @mjustynaPhD . It seems like the issue is solved. If this comes up again, we'll reopen the issue.