Plotting issue on fresh install
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 323
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm trying to run the pbmc5k tutorial:
import snapatac2 as snap
fragment_file = snap.datasets.pbmc5k()
data = snap.pp.import_fragments(
fragment_file,
chrom_sizes=snap.genome.hg38,
file="pbmc.h5ad",
sorted_by_barcode=False,
)
data
snap.pl.frag_size_distr(data, interactive=False)
and get the following error:
2025-10-07 15:18:23 - INFO - Computing fragment size distribution...
[/work/Home/venvs/omics/lib/python3.12/site-packages/kaleido/_sync_server.py:11](/Home/venvs/omics/lib/python3.12/site-packages/kaleido/_sync_server.py#line=10): UserWarning:
Warning: You have Plotly version 5.24.1, which is not compatible with this version of Kaleido (1.1.0).
This means that static image generation (e.g. `fig.write_image()`) will not work.
Please upgrade Plotly to version 6.1.1 or greater, or downgrade Kaleido to version 0.2.1.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[4], line 1
----> 1 snap.pl.frag_size_distr(data, interactive=False)
File [/work/Home/venvs/omics/lib/python3.12/site-packages/snapatac2/plotting/__init__.py:135](Home/venvs/omics/lib/python3.12/site-packages/snapatac2/plotting/__init__.py#line=134), in frag_size_distr(adata, use_rep, max_recorded_size, **kwargs)
130 fig.add_trace(go.Scatter(x=x[1:], y=y[1:], mode='lines'))
131 fig.update_layout(
132 xaxis_title="Fragment size",
133 yaxis_title="Count",
134 )
--> 135 return render_plot(fig, **kwargs)
File [/work/Home/venvs/omics/lib/python3.12/site-packages/snapatac2/plotting/_base.py:286](/Home/venvs/omics/lib/python3.12/site-packages/snapatac2/plotting/_base.py#line=285), in render_plot(fig, width, height, interactive, show, out_file, scale)
284 else:
285 from IPython.display import Image
--> 286 return Image(fig.to_image(format="png"))
288 # return plot object
289 if not show and not out_file: return fig
File [/work/Home/venvs/omics/lib/python3.12/site-packages/plotly/basedatatypes.py:3772](/Home/venvs/omics/lib/python3.12/site-packages/plotly/basedatatypes.py#line=3771), in BaseFigure.to_image(self, *args, **kwargs)
3717 """
3718 Convert a figure to a static image bytes string
3719
(...) 3768 The image data
3769 """
3770 import plotly.io as pio
-> 3772 return pio.to_image(self, *args, **kwargs)
File [/work/Home/venvs/omics/lib/python3.12/site-packages/plotly/io/_kaleido.py:132](/Home/venvs/omics/lib/python3.12/site-packages/plotly/io/_kaleido.py#line=131), in to_image(fig, format, width, height, scale, validate, engine)
130 # Raise informative error message if Kaleido is not installed
131 if scope is None:
--> 132 raise ValueError(
133 """
134 Image export using the "kaleido" engine requires the kaleido package,
135 which can be installed using pip:
136 $ pip install -U kaleido
137 """
138 )
140 # Validate figure
141 # ---------------
142 fig_dict = validate_coerce_fig_to_dict(fig, validate)
ValueError:
Image export using the "kaleido" engine requires the kaleido package,
which can be installed using pip:
$ pip install -U kaleido
I installed the package version 2.8.0 from Bioconda in a fresh conda environment.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the pbmc5k tutorial and start with snapatac2/plotting/init.py, then follow render_plot in snapatac2/plotting/_base.py where the static image conversion fails. Check the installed Plotly and Kaleido versions against this path; done means frag_size_distr(data, interactive=False) renders successfully in a fresh installation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- plotly, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100