简体   繁体   English

即使安装了 kaleido 也无法保存绘图图像

[英]Saving a plotly image not working with kaleido even though it is installed

I am trying to save a simple plotly figure to a directory.我正在尝试将一个简单的情节图保存到目录中。 I understand it needs kaleido (I have version '0.2.1') and also at least plotly '5.3.1' which are installed.我知道它需要万花筒(我有版本'0.2.1')并且至少需要安装'5.3.1'。

However trying to save the image I get the following error:但是尝试保存图像时出现以下错误:

fig.write_image(path)

ValueError: 
Image export using the "kaleido" engine requires the kaleido package,
which can be installed using pip:
$ pip install -U kaleido

Why is this occuring when all the required packages are there?当所有必需的软件包都在那里时,为什么会发生这种情况?

I've got exactly the same issue on google colab.我在 google colab 上遇到了完全相同的问题。 Even after installation kaleido, the same error.即使在安装kaleido之后,同样的错误。 Accidentally I've found fix, it seems necesarry to import kaleido first:偶然我找到了解决方法,似乎需要先导入万花筒:

!pip install kaleido
import kaleido #required
kaleido.__version__ #0.2.1

import plotly
plotly.__version__ #5.5.0

#now this works:
import plotly.graph_objects as go

fig = go.Figure()
fig.write_image('aaa.png')

The transition from Orca to Kaleido is not without speed bumps.从 Orca 到 Kaleido 的过渡并非没有减速带。

For users on Windows 10 and 11, users seem to have luck rolling back to Kaleido version 0.1.0, see.对于 Windows 10 和 11 上的用户,用户似乎有幸回滚到 Kaleido 版本 0.1.0,请参阅。 https://github.com/plotly/Kaleido/issues/110 https://github.com/plotly/Kaleido/issues/110

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用 Kaleido 导出 Plotly 图表不起作用? - Exporting Plotly charts with Kaleido not working? Plotly write.image() 与 kaleido 0.2.1 一起冻结 - Plotly write.image() freezes with kaleido 0.2.1 Pygame 无法在 VS Code 上运行,即使它已安装 - Pygame not working on VS Code even though it is installed Pandas 即使已安装也无法正常工作 - Pandas not working even though its installed pip无法正常运行,即使已正确安装 - pip is not working , even though it is properly installed 尝试导入 plotly.express 但即使安装了 pandas 也会出现此错误:ImportError: Plotly express requires Z3A402204F88A9C25AD to be installed - Trying to import plotly.express but get this error even though pandas is installed: ImportError: Plotly express requires pandas to be installed 无法在 jupyter 笔记本上导入袖扣和 plotly,即使它已经安装在 cmd 上 - Could not import cufflinks and plotly on jupyter notebook even though it has already been installed on cmd Plotly.io 没有看到 psutil package,即使它已安装 - Plotly.io doesn't see the psutil package even though it's installed 无法使用 Kaleido 将 plotly 图像导出为 png - Unable to export plotly images to png with Kaleido Cython “ModuleNotFoundError”,即使它只是在构建 docker 映像时通过 requirements.txt 安装 - Cython “ModuleNotFoundError” even though it was just installed via requirements.txt while building docker image
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM