Machine learning 在AWS Sagemaker JupyterLab中绘出空白图形

Machine learning 在AWS Sagemaker JupyterLab中绘出空白图形,machine-learning,plotly,amazon-sagemaker,jupyter-lab,plotly-python,Machine Learning,Plotly,Amazon Sagemaker,Jupyter Lab,Plotly Python,背景:我是Python世界的新手,正在使用Plotly在Python中创建基本图形。我正在使用AWS Sagemaker的JupyterLab创建python脚本 问题:我一直在尝试运行Plotly网站上提到的基本代码,但即使是这些代码也返回空白图形 我自己尝试的问题解决方案: pip在plotly 4.6.0版上安装 关于JupyterLab支持的步骤已经执行 代码示例: import plotly.graph_objects as go fig = go.Figure(data=go.Bar

背景:我是Python世界的新手,正在使用Plotly在Python中创建基本图形。我正在使用AWS Sagemaker的JupyterLab创建python脚本

问题:我一直在尝试运行Plotly网站上提到的基本代码,但即使是这些代码也返回空白图形

我自己尝试的问题解决方案:

  • pip在plotly 4.6.0版上安装

  • 关于JupyterLab支持的步骤已经执行

  • 代码示例:

    import plotly.graph_objects as go
    fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
    fig.show()
    

    我认为文件不符合标准。您现在需要安装
    jupyterlab-plotly
    extension

    jupyter labextension install jupyterlab-plotly
    
    更新 我遵循了一系列的指示和建议

    首先从jupyter实验室启用扩展管理器 然后从终点站

    conda  install -c conda-forge "nbformat" "ipywidgets>=7.5" -y
    
    jupyter labextension install jupyterlab-plotly
    jupyter labextension install @jupyter-widgets/jupyterlab-manager plotlywidget
    
    在你的环境中

    conda install nbformat
    

    我最近也有同样的问题。建议的简单改变对我有帮助。我知道这是一个临时的解决办法,直到找到一个合适的解决办法

    // fig = go.Figure()
    fig = go.FigureWidget()    // replace with this
    // fig.show()
    fig                        // remove .show()
    

    你好@rpanai,我试过你的代码。它循环着说“jupyterlab”-plotly@file:../extensions/jupyterlab-plotly-4.6.0.tgz“这持续了大约13分钟,然后程序退出。我已经尝试了多次,但是没有任何帮助。我更新了我的答案。