Plotly.py: Add nbformat to dependencies

Created on 4 Feb 2020  路  18Comments  路  Source: plotly/plotly.py

Apparently nbformat is required by the latest plotly version. After a clean install if I try to plot I receive back this error

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

If you want I can update the requirements that I guess are here.

Most helpful comment

Same issue arises when using Jupyter notebooks within VSCode, which seems to be becoming a popular Jupyter client.

All 18 comments

Hi @rpanai thank you for the report. On top of the requirements listed in requirements.txt, we also have some optional requirements which are not installed by defaults. nbformat is indeed needed to display figures in the notebook. It is a hard dependency of the jupyter-notebook package, so you must have it installed unless you have a very old version of the notebook (nbformat 4.2 was released in December 2016). Could you please confirm that you trying to plot plotly figures inside the jupyter notebook, and also check the versions of jupyter notebook and nbformat which you are using? I don't think we will update the requirements.txt because it's only an optional dependency and for a large majority of users (who have updated the notebook since Dec. 2016) it will be already installed. Of course if this is more complex happy to keep on discussing this with you.

Hi @emmanuelle,

  • I was trying to plot inside jupyter-lab
  • jupyterlab=0.35.5 was installed in July 2019
  • nbformat wasn't installed and it's not required by lab see requirement but you're right that's required by jupyter notebook

Anyway apparently this happened on my laptop only as on my VMs I didn't have this problem.

Hi @rpanai for jupyter-lab plotly requires a separate extension jupyterlab-plotly to be installed as described in https://plot.ly/python/getting-started/#jupyterlab-support-python-35, was it the case for you?

Yes it was.

@emmanuelle I double checked and yes there is an issue. When you have several kernels you can access from jupyter-lab/notebook you need to install nbformat within the kernel in order to have plotly works. In the previous version it wasn't necessary.

any updates?

any updates?

Not that I know. I've to install nbformat in all my environments with plotly.

same

I'll take a closer look and consider adding it to our documentation as a requirement when using JupyterLab. I'm not inclined to add it to the hard requirements for the whole library, though, as not everyone uses Jupyter :)

Same issue arises when using Jupyter notebooks within VSCode, which seems to be becoming a popular Jupyter client.

Same issue arises when using Jupyter notebooks within VSCode, which seems to be becoming a popular Jupyter client.

Same thing is happening with me.

Hello guys, same thing happening with me too

I have the same issue running Jupyter Notebooks with VSCode. Nbformat version 5.0.8 already installed

Hi folks, what is the "same thing" you are are referring to here, that you have to manually install nbformat or that something is broken even when you do?

@nicolaskruchten I guess that the problem is that we have to install nbformat.

@nicolaskruchten
I have nbformat, plotly and other libraries already installed in conda environment. But when running jupyter notebook with Plotly plots in VSCode it is throwing an error:
ValueError: Mime type rendering requires nbformat>=4.2.0 but it is not installed

I created virtualenv (same dependencies) with Pipenv tool and installed a new kernel in Jupyter. When running notebook in VSCode issue resolved itself.

Hi folks, what is the "same thing" you are are referring to here, that you have to manually install nbformat or that something is broken even when you do?

Just the manual install of nbformat. All works perfectly once installed :) (I am specifically referring to Jupyter inside VSCode)

I did the manual install of nbformat and all works for me too, and I'm talking about Jupyter inside VSCode as well.

Was this page helpful?
0 / 5 - 0 ratings