conda install -c conda-forge plotly python-kaleido

未關閉
#359 4 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
1-2 天
新手友好度
42/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
plotly, python

研究方向

使用 conda 套件和 test.py 重現此故障,然後將其與正常運作的 pip 安裝進行比較。從 traceback 中顯示的 to_image 路徑所在的 plotly/io/_kaleido.py 開始,檢查如何找出已安裝的 Kaleido 版本。當透過 conda 安裝的套件能讓 test.py 在不出現 AttributeError 的情況下產生 fig.png 時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

bug P3

plotly and python-kaleido Install in a brand new Conda env

❯❯❯ conda install -c conda-forge plotly python-kaleido -y
2 channel Terms of Service accepted
Channels:
 - conda-forge
 - defaults
Platform: osx-arm64
Collecting package metadata (repodata.json): done
Solving environment: done

## Package Plan ##

  environment location: /opt/miniconda3/envs/bsa3

  added / updated specs:
    - plotly
    - python-kaleido


The following NEW packages will be INSTALLED:

  narwhals           conda-forge/noarch::narwhals-1.48.0-pyhe01879c_0 
  packaging          conda-forge/noarch::packaging-25.0-pyh29332c3_1 
  plotly             conda-forge/noarch::plotly-6.2.0-pyhd8ed1ab_0 
  python-kaleido     conda-forge/noarch::python-kaleido-1.0.0-pyhe01879c_0 



Downloading and Extracting Packages:

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

Packages that have been installed in the current environment

❯❯❯ conda list
# packages in environment at /opt/miniconda3/envs/bsa3:
#
# Name                     Version          Build               Channel
bzip2                      1.0.8            h99b78c6_7          conda-forge
ca-certificates            2025.7.14        hbd8a1cb_0          conda-forge
choreographer              1.0.9            pyhe01879c_0        conda-forge
libexpat                   2.7.1            hec049ff_0          conda-forge
libffi                     3.4.6            h1da3d7d_1          conda-forge
liblzma                    5.8.1            h39f12f2_2          conda-forge
libsqlite                  3.50.3           hf8de324_0          conda-forge
libzlib                    1.3.1            h8359307_2          conda-forge
logistro                   1.1.0            pyhe01879c_0        conda-forge
narwhals                   1.48.0           pyhe01879c_0        conda-forge
ncurses                    6.5              h5e97a16_3          conda-forge
openssl                    3.5.1            h81ee809_0          conda-forge
orjson                     3.11.0           py312h6f58b40_0     conda-forge
packaging                  25.0             pyh29332c3_1        conda-forge
pip                        25.1.1           pyh8b19718_0        conda-forge
plotly                     6.2.0            pyhd8ed1ab_0        conda-forge
python                     3.12.11          hc22306f_0_cpython  conda-forge
python-kaleido             1.0.0            pyhe01879c_0        conda-forge
python_abi                 3.12             8_cp312             conda-forge
readline                   8.2              h1d1bf99_2          conda-forge
setuptools                 80.9.0           pyhff2d567_0        conda-forge
simplejson                 3.20.1           py312hea69d52_0     conda-forge
tk                         8.6.13           h892fb3f_2          conda-forge
tzdata                     2025b            h78e105d_0          conda-forge
wheel                      0.45.1           pyhd8ed1ab_1        conda-forge

Create a file named test.py

import plotly.graph_objects as go

fig = go.Figure(data=go.Scatter(y=[2, 1, 4, 3]))


fig.write_image("fig.png")
❯❯❯ python3 test.py
/Users/gh/Desktop/TestFile/test.py:6: DeprecationWarning:


Support for Kaleido versions less than 1.0.0 is deprecated and will be removed after September 2025.
Please upgrade Kaleido to version 1.0.0 or greater (`pip install 'kaleido>=1.0.0'` or `pip install 'plotly[kaleido]'`).


Traceback (most recent call last):
  File "/Users/gh/Desktop/TestFile/test.py", line 6, in <module>
    fig.write_image("fig.png")
  File "/opt/miniconda3/envs/bsa3/lib/python3.12/site-packages/plotly/basedatatypes.py", line 3895, in write_image
    return pio.write_image(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/bsa3/lib/python3.12/site-packages/plotly/io/_kaleido.py", line 510, in write_image
    img_data = to_image(
               ^^^^^^^^^
  File "/opt/miniconda3/envs/bsa3/lib/python3.12/site-packages/plotly/io/_kaleido.py", line 398, in to_image
    img_bytes = scope.transform(
                ^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'transform'

Install the requirement package through pip in a brand-new Conda environment: 'pip install kaleido plotly', and then execute the command:' python3 test.py', which will get the correct graph and will not cause any errors in the process.

主要語言
Python
星號
504
分支
65
平均合併
6 天 9 小時
30 天內合併 PR
2

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

plotly/kaleido 的其他 Issue

查看 plotly/kaleido 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。