plotly / plotly/plotly.py

Jupyterlab requirement

オープン
#5,184 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug P2 regression
主要言語
Python
スター
18.8k
フォーク
2.8k
平均マージ
16時間 26分
マージ済み PR(30日)
21

説明

Hi all,

This seems to be related to the PR https://github.com/plotly/plotly.py/pull/5104

The check for jupyterlab is still failing on my end. I have a LabEnv that uses other kernels in other environments. It keeps prod environments lean.

Similar to the original poster of the issue linked to the above PR, I get the following error when trying to plot using plotly.


AttributeError Traceback (most recent call last)
Cell In[10], line 88
85 else:
86 colors.append(DECREASING_COLOR)
---> 88 iplot( fig, filename = 'candlestick-ichimoku' )

File ~/micromamba/envs/trader/lib/python3.12/site-packages/plotly/offline/offline.py:387, in iplot(figure_or_data, show_link, link_text, validate, image, filename, image_width, image_height, config, auto_play, animation_opts)
382 post_script = build_save_image_post_script(
383 image, filename, image_height, image_width, "iplot"
384 )
386 # Show figure
--> 387 pio.show(
388 figure,
389 validate=validate,
390 config=config,
391 auto_play=auto_play,
392 post_script=post_script,
393 animation_opts=animation_opts,
394 )

File ~/micromamba/envs/trader/lib/python3.12/site-packages/plotly/io/_renderers.py:429, in show(fig, renderer, validate, **kwargs)
424 if not nbformat or Version(nbformat.version) < Version("4.2.0"):
425 raise ValueError(
426 "Mime type rendering requires nbformat>=4.2.0 but it is not installed"
427 )
--> 429 display_jupyter_version_warnings()
431 ipython_display.display(bundle, raw=True)
433 # external renderers

File [~/micromamba/envs/trader/lib/python3.12/site-packages/plotly/io/_renderers.py:60]
(http://localhost:8888/home/omagaiii/micromamba/envs/trader/lib/python3.12/site-packages/plotly/io/_renderers.py#line=59), in display_jupyter_version_warnings()
58 elif "jupyter-lab" in parent_process:
59 jupyter_lab = optional_imports.get_module("jupyterlab")
---> 60 if jupyter_lab.version < "3":
61 # Add warning about upgrading jupyterlab
62 warnings.warn(
63 f"Plotly version >= 6 requires JupyterLab >= 3 but you have {jupyter_lab.version} installed. To upgrade JupyterLab, please run pip install jupyterlab --upgrade."
64 )

AttributeError: 'NoneType' object has no attribute 'version'

plotly version:

import plotly
plotly.__version__
'6.0.1'

Python version:

from platform import python_version
python_version()
'3.12.10'

Jupyterlab/host version:

jupyter lab --version 
4.4.1

Jupyterlab/client version:

import jupyter_client
jupyter_client.__version__
'8.6.3'

BTW, the check above for the jupyter_client is probably what needs to be added in the code to fix remote execution. Below is how I 'fixed' it so I can move on for the time being, but probably missing other nuances.

    elif "jupyter-lab" in parent_process:
        jupyter_lab = optional_imports.get_module("jupyterlab") or optional_imports.get_module("jupyter_client")
        if jupyter_lab.__version__ < "3":

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

plotly/io/_renderers.py の display_jupyter_version_warnings() から始め、続いて jupyterlab と jupyter_client に対する optional_imports の動作を調べます。issue に記載されている分離された JupyterLab と kernel の環境を再現し、JupyterLab のバージョン警告が正しいままで、プロット時に NoneType AttributeError が発生しなくなったことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
jupyter, python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。