Kaleido Issues with Plotly file generation

Question:
I’m trying to create a Plotly image and write it to a file. Exactly as described here. I added the plotly and kaleido packages as required but when running the application, I get the following error:

Traceback (most recent call last):
  File "main.py", line 27, in <module>
    fig.write_image(tmp_filename)
  File "/home/runner/FredTelegramBot/venv/lib/python3.10/site-packages/plotly/basedatatypes.py", line 3821, in write_image
    return pio.write_image(self, *args, **kwargs)
  File "/home/runner/FredTelegramBot/venv/lib/python3.10/site-packages/plotly/io/_kaleido.py", line 267, in write_image
    img_data = to_image(
  File "/home/runner/FredTelegramBot/venv/lib/python3.10/site-packages/plotly/io/_kaleido.py", line 144, in to_image
    img_bytes = scope.transform(
  File "/home/runner/FredTelegramBot/venv/lib/python3.10/site-packages/kaleido/scopes/plotly.py", line 153, in transform
    response = self._perform_transform(
  File "/home/runner/FredTelegramBot/venv/lib/python3.10/site-packages/kaleido/scopes/base.py", line 293, in _perform_transform
    self._ensure_kaleido()
  File "/home/runner/FredTelegramBot/venv/lib/python3.10/site-packages/kaleido/scopes/base.py", line 198, in _ensure_kaleido
    raise ValueError(message)
ValueError: Failed to start Kaleido subprocess. Error stream:

./bin/kaleido: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /nix/store/mdck89nsfisflwjv6xv8ydj7dj0sj2pn-gcc-11.3.0-lib/lib/libgcc_s.so.1)

Some searches suggest installing glibc via sudo, but I don’t have permissions to do that.

sudo app update
sudo app install libc6

Has anyone encountered this issue and has a solution?

Repl link:

Relevant code:

import plotly.graph_objects as go
import numpy as np

np.random.seed(1)

N = 100
x = np.random.rand(N)
y = np.random.rand(N)
colors = np.random.rand(N)
sz = np.random.rand(N) * 30

fig = go.Figure()
fig.add_trace(go.Scatter(
    x=x,
    y=y,
    mode="markers",
    marker=go.scatter.Marker(
        size=sz,
        color=colors,
        opacity=0.6,
        colorscale="Viridis"
    )
))

tmp_filename = "123.png"
fig.write_image(tmp_filename)