在 jupyter 实验室中未呈现 Plotly Express

Mth*_*Clv 10 python plotly jupyter-lab plotly-express

以下代码不会在 Jupyter 实验室中呈现:

%matplotlib widget
import plotly.express as px  
import numpy as np 
import pandas as pd

df = pd.DataFrame(np.random.randint(0,100,size=(5, 4)), columns=list('ABCD'))
px.bar(df, x='A', y='B')
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明 我试图安装这里提到的所有依赖项和扩展 https://plot.ly/python/getting-started/#jupyterlab-support-python-35

还有这里的步骤 https://github.com/matplotlib/jupyter-matplotlib

没有任何效果

这是我的设置:

jupyter lab --version
1.0.2

python --version
Python 3.6.1 :: Continuum Analytics, Inc.

conda list jupyterlab
# packages in environment at C:\Users\***\Anaconda3:
#
# Name                    Version                   Build  Channel
jupyterlab                1.0.2            py36hf63ae98_0
jupyterlab_launcher       0.13.1                   py36_0
jupyterlab_server         1.0.0                      py_0

conda list nodejs
# packages in environment at C:\Users\***\Anaconda3:
#
# Name                    Version                   Build  Channel
nodejs                    0.1.1                    pypi_0    pypi

conda list plotly
# packages in environment at C:\Users\***\Anaconda3:
#
# Name                    Version                   Build  Channel
plotly                    4.1.0                    pypi_0    pypi
plotly-express            0.4.1                    pypi_0    pypi
Run Code Online (Sandbox Code Playgroud)

编辑:

jupyter-labextension list
JupyterLab v1.0.2
Known labextensions:
   app dir: C:\Users\***\Anaconda3\share\jupyter\lab
        @jupyter-widgets/jupyterlab-manager v1.0.2 enabled  ok
        @jupyterlab/git v0.8.0 enabled  ok
        @jupyterlab/plotly-extension v1.0.0 enabled  ok
        jupyter-matplotlib v0.4.2 enabled  ok
        jupyterlab-chart-editor v1.2.0 enabled  ok
        jupyterlab-plotly v1.1.0 enabled  ok
        plotlywidget v1.1.0 enabled  ok
Run Code Online (Sandbox Code Playgroud)

nic*_*ten 7

编辑:这些说明和更多内容现在在我们的官方故障排除指南中

可能是先前安装的残余或安装尝试导致了问题。我建议从全新安装或卸载所有 Plotly 模块(来自 pip 和 conda!)和与 plotly 相关的 jlab 扩展开始,然后按照此处的说明进行操作:https ://plot.ly/python/getting-started/

卸载模块是一个问题

conda uninstall plotly
pip uninstall plotly
Run Code Online (Sandbox Code Playgroud)

然后根据上面链接的说明重新安装一个或另一个而不是两个。

卸载 JupyterLab 扩展是通过

jupyter labextension uninstall @jupyterlab/plotly-extension
jupyter labextension uninstall jupyterlab-plotly 
jupyter labextension uninstall plotlywidget
Run Code Online (Sandbox Code Playgroud)