[英]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.