Skip to content

ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed #4512

Closed

Description

@NotShrirang

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.

Activity

  1. Coding-with-Adam commented on Feb 9, 2024

    @Coding-with-Adam
    Contributor

    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()
    
  2. mjustynaPhD commented on Feb 21, 2024

    @mjustynaPhD

    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!

  3. Coding-with-Adam commented on Feb 23, 2024

    @Coding-with-Adam
    Contributor

    Thank you @mjustynaPhD . It seems like the issue is solved. If this comes up again, we'll reopen the issue.

  4. jasonlin90125 commented on Jun 6, 2025

    @jasonlin90125

    Hello, I am getting this same error from plotly 6.1.2. Not getting the issue with 5.18.0, like @mjustynaPhD mentioned.

  5. afeld commented on Oct 16, 2025

    @afeld
    Contributor

    Not in the dependencies.

    plotly.py/pyproject.toml

    Lines 36 to 39 in 3da153f

    dependencies = [
    "narwhals>=1.15.1",
    "packaging"
    ]

    Can this issue be re-opened?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions