Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plotly.write_image fails to find Kaleido executable #210

Open
augustebaum opened this issue Oct 24, 2024 · 3 comments
Open

plotly.write_image fails to find Kaleido executable #210

augustebaum opened this issue Oct 24, 2024 · 3 comments
Assignees
Labels
stale no activity

Comments

@augustebaum
Copy link

Versions:

  • plotly: 5.24.1
  • Kaleido: 0.2.1

To reproduce:

import plotly.graph_objects as go
fig = go.Figure()
fig.write_image('test.png')

I get the error:

FileNotFoundError: [Errno 2] No such file or directory: '/my/project/.venv/lib/python3.12/site-packages/kaleido/executable/kaleido'

which is true: in my filesystem the executable is installed as

/my/project/.venv/lib/python3.12/site-packages/kaleido/executable/bin/kaleido

(note the /bin)

@gvwilson
Copy link
Collaborator

@augustebaum we are prototyping a completely new version of Kaleido that may resolve some of these issues - if you'd like to help us test it out on your platform, please email me ([email protected]) and I'll point you in the right direction. thanks - @gvwilson

@gvwilson gvwilson transferred this issue from plotly/plotly.py Oct 24, 2024
@ayjayt ayjayt added the active label Oct 25, 2024
augustebaum added a commit to probabl-ai/skore that referenced this issue Oct 29, 2024
This is a quick fix to address #594.

In the end, I took a screenshot manually (by using the "Download plot as png" button of the Plotly widget) and displayed it with matplotlib.

Here are all the alternatives I considered, and what didn't work with them:
- Use SVG instead of PNG
	- For that, I'd need to use Plotly's `fig.write_image`, and the library that Plotly uses for this, Kaleido, is currently broken: plotly/Kaleido#210
- Export plotly figure to a file during the example and read it 
	- For that I also need Plotly's `fig.write_image`
- Use Pillow for displaying, instead of matplotlib (which is not really made for that)
	- Only matplotlib is supported by sphinx-gallery, the library that renders the examples
augustebaum added a commit to probabl-ai/skore that referenced this issue Oct 29, 2024
This is a quick fix to address #594.

In the end, I took a screenshot manually (by using the "Download plot as png" button of the Plotly widget) and displayed it with matplotlib.

Here are all the alternatives I considered, and what didn't work with them:
- Use SVG instead of PNG
	- For that, I'd need to use Plotly's `fig.write_image`, and the library that Plotly uses for this, Kaleido, is currently broken: plotly/Kaleido#210
- Export plotly figure to a file during the example and read it 
	- For that I also need Plotly's `fig.write_image`
- Use Pillow for displaying, instead of matplotlib (which is not really made for that)
	- Only matplotlib is supported by sphinx-gallery, the library that renders the examples
augustebaum added a commit to probabl-ai/skore that referenced this issue Oct 29, 2024
This is a quick fix to address #594.

In the end, I took a screenshot manually (by using the "Download plot as png" button of the Plotly widget) and displayed it with matplotlib.

Here are all the alternatives I considered, and what didn't work with them:
- Use SVG instead of PNG
	- For that, I'd need to use Plotly's `fig.write_image`, and the library that Plotly uses for this, Kaleido, is currently broken: plotly/Kaleido#210
- Export plotly figure to a file during the example and read it
	- For that I also need Plotly's `fig.write_image`
- Use Pillow for displaying, instead of matplotlib (which is not really made for that)
	- Only matplotlib is supported by sphinx-gallery, the library that renders the examples
augustebaum added a commit to probabl-ai/skore that referenced this issue Oct 29, 2024
This is a quick fix to address #594.

In the end, I took a screenshot manually (by using the "Download plot as png" button of the Plotly widget) and displayed it with matplotlib.

Here are all the alternatives I considered, and what didn't work with them:
- Use SVG instead of PNG
	- For that, I'd need to use Plotly's `fig.write_image`, and the library that Plotly uses for this, Kaleido, is currently broken: plotly/Kaleido#210
- Export plotly figure to a file during the example and read it
	- For that I also need Plotly's `fig.write_image`
- Use Pillow for displaying, instead of matplotlib (which is not really made for that)
	- Only matplotlib is supported by sphinx-gallery, the library that renders the examples
augustebaum added a commit to probabl-ai/skore that referenced this issue Oct 29, 2024
This is a quick fix to address #594.

In the end, I took a screenshot manually (by using the "Download plot as
png" button of the Plotly widget) and displayed it with matplotlib.

Here are all the alternatives I considered, and what didn't work with
them:
- Use SVG instead of PNG
- For that, I'd need to use Plotly's `fig.write_image`, and the library
that Plotly uses for this, Kaleido, is currently broken:
plotly/Kaleido#210
- Export plotly figure to a file during the example and read it 
	- For that I also need Plotly's `fig.write_image`
- Use Pillow for displaying, instead of matplotlib (which is not really
made for that)
- Only matplotlib is supported by sphinx-gallery, the library that
renders the examples
@ayjayt ayjayt self-assigned this Nov 15, 2024
@ayjayt ayjayt added stale no activity and removed active labels Nov 15, 2024
@ayjayt
Copy link
Collaborator

ayjayt commented Nov 15, 2024

There is a new version of kaleido out, I wonder if there is any follow up to this?

@obarbachan
Copy link

I'm using plotly==5.24.1 and have faced the same issue. Add to this that simply putting kaleido in requirements.txt does not solve the problem as follows:

ERROR: Ignored the following yanked versions: 0.4.0, 0.4.1, 0.4.2
ERROR: Could not find a version that satisfies the requirement kaleido (from versions: 0.4.0rc1, 0.4.0rc2, 0.4.0rc3, 0.4.0rc4, 0.4.0rc5, 1.0.0rc0)
ERROR: No matching distribution found for kaleido

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity
Projects
None yet
Development

No branches or pull requests

4 participants