Reputation: 91
I have successfully installed the Plotly python libraries to work with JupyterLab. I have the proper extensions installed. (All directions were followed according to: https://plot.ly/python/getting-started/ )
Most basic plots show up in my notebook file just fine, with interactivity working great! However, some plots are not appearing, and I have no idea why.
For example, the following works just fine:
import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length",
color="species", marginal_y="rug", marginal_x="histogram")
fig.show()
However, a simple scatter_matrix
or parallel_coordinates
shows no output. For example, the following does not work:
fig = px.scatter_matrix(df, color="species")
fig.show()
No errors appear on the console or in the output cell. The cell executes, and that's it. It doesn't show any result.
I did the following:
conda update --all -c plotly -c conda-forge
jupyter lab clean
and jupyter lab build
.plotly.graph_objects
API instead of plotly.express
. Same outcome. I still have the same problems.
It's worth noting that I CAN do the following:
fig = px.scatter_matrix(df, color="species")
fig.show(renderer='browser')
And that automatically opens the browser window and works just fine. So, it seems that the plotly engine itself is fine, there is just something up with the jupyter connection for some types of plots.
Any suggestions on where to look, or what I'm doing wrong? Thank you!
Upvotes: 2
Views: 4474
Reputation: 91
Well, after trying out a lot of different things to get this working, I finally went back and decided to just clean everything up. I did the following:
conda clean --all
conda update --all -c plotly -c defaults -c conda-forge
(The order of the channel specifiers is important!)jupyter labextension update --all
jupyter lab clean
jupyter lab build
And, I also noticed that my notebook was not trusted. So, I made the notebook trusted. And, now everything is working! There were MANY updates when I did conda update --all
above because of the order that I used with the channels. I definitely put the defaults
channel as higher priority, with left far fewer packages installed from conda-forge
. This changed the version of a lot of packages, but I'm not certain which ones. I could look through the revisions in conda and get that list later, though packages are always being updated, so it might not be relevant.
I wondered if it was possible that setting the notebook to trusted was really the only problem? Well, I tried to clear the trust setting:
jupyter trust --reset
And, it still worked. So, I'm inclined to believe that it was not a trust issue with the notebook, but some version conflict with the numerous packages that I updated from the main conda channel defaults
instead of conda-forge
.
For the moment, all is well. Thanks, rpanai for chiming in.
Upvotes: 2