Cannot use `write_image` to save 3d figure on jupyter notebook on remote cluster
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- jupyter-notebook, plotly, python
- Área
- data-visualization
Línea de trabajo
Comience revisando el punto de entrada write_image reportado y el archivo adjunto choreo_diagnose_output.txt; después, reproduzca el fallo en un entorno remoto o slim sin acceso a sudo. Siga cómo Kaleido informa de la falta de dependencias del navegador y defina cómo debería ser una configuración correcta y compatible o un mensaje de error útil.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi! I am using a Jupyter notebook on a remote cluster (on which I do NOT have sudo access as it is a shared computing resource of which I am only a user), and in trying to save a 3d figure using write_image I get this error:
---------------------------------------------------------------------------
CancelledError Traceback (most recent call last)
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/choreographer/browser_async.py:151, in Browser.open(self)
150 _logger.debug("Populating Targets")
--> 151 await self.populate_targets()
152 except (BrowserClosedError, BrowserFailedError, asyncio.CancelledError) as e:
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/kaleido/kaleido.py:223, in Kaleido.populate_targets(self)
217 """
218 Override the browser populate_targets to ensure the correct page.
219
220 Is called automatically during initialization, and should only be called
221 once ever per object.
222 """
--> 223 await super().populate_targets()
224 await self._conform_tabs()
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/choreographer/browser_async.py:291, in Browser.populate_targets(self)
290 raise BrowserClosedError("populate_targets() called on a closed browser")
--> 291 response = await self.send_command("Target.getTargets")
292 if "error" in response:
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/choreographer/protocol/devtools_async.py:222, in Target.send_command(self, command, params)
221 session = self.get_session()
--> 222 return await session.send_command(command, params)
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/choreographer/protocol/devtools_async.py:95, in Session.send_command(self, command, params)
94 _logger.debug2(f"Full params: {str(params).replace('%', '%%')}")
---> 95 return await self._broker.write_json(json_command)
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/choreographer/_brokers/_async.py:259, in Broker.write_json(self, obj)
258 _logger.debug(f"Future for {key} deleted.")
--> 259 return await future
CancelledError:
The above exception was the direct cause of the following exception:
BrowserDepsError Traceback (most recent call last)
Cell In[21], line 5
2 fig = plot_3d(
3 eq_opt.surface, "B*n", field=coils_opt, alpha=0.5, grid=LinearGrid(M=20, N=40, NFP=1, endpoint=True)) # pass in surface so the Bplasma is not computed, as it is vacuum
4 plot_coils(coils_opt, fig=fig)
----> 5 fig.write_image(f"{dirname}/QA_eq_and_coils_{i}_3d.png")
6 plot_2d(
7 eq_opt.surface,
8 "B*n",
9 field=coils_opt,
10 cmap="viridis",
11 )
12 plt.savefig(f"{dirname}/QA_eq_{i}_2d_Bn_error.png")
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/plotly/basedatatypes.py:3895, in BaseFigure.write_image(self, *args, **kwargs)
3891 if kwargs.get("engine", None):
3892 warnings.warn(
3893 ENGINE_PARAM_DEPRECATION_MSG, DeprecationWarning, stacklevel=2
3894 )
-> 3895 return pio.write_image(self, *args, **kwargs)
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/plotly/io/_kaleido.py:510, in write_image(fig, file, format, scale, width, height, validate, engine)
506 format = infer_format(path, format)
508 # Request image
509 # Do this first so we don't create a file if image conversion fails
--> 510 img_data = to_image(
511 fig,
512 format=format,
513 scale=scale,
514 width=width,
515 height=height,
516 validate=validate,
517 engine=engine,
518 )
520 # Open file
521 if path is None:
522 # We previously failed to make sense of `file` as a pathlib object.
523 # Attempt to write to `file` as an open file descriptor.
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/plotly/io/_kaleido.py:380, in to_image(fig, format, width, height, scale, validate, engine)
377 kopts["mathjax"] = defaults.mathjax
379 # TODO: Refactor to make it possible to use a shared Kaleido instance here
--> 380 img_bytes = kaleido.calc_fig_sync(
381 fig_dict,
382 opts=dict(
383 format=format or defaults.default_format,
384 width=width or defaults.default_width,
385 height=height or defaults.default_height,
386 scale=scale or defaults.default_scale,
387 ),
388 topojson=defaults.topojson,
389 kopts=kopts,
390 )
391 except ChromeNotFoundError:
392 raise RuntimeError(PLOTLY_GET_CHROME_ERROR_MSG)
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/kaleido/__init__.py:171, in calc_fig_sync(*args, **kwargs)
169 return _global_server.call_function("calc_fig", *args, **kwargs)
170 else:
--> 171 return _sync_server.oneshot_async_run(calc_fig, args=args, kwargs=kwargs)
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/kaleido/_sync_server.py:131, in oneshot_async_run(func, args, kwargs)
129 res = q.get()
130 if isinstance(res, BaseException):
--> 131 raise res
132 else:
133 return res
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/kaleido/_sync_server.py:122, in oneshot_async_run.<locals>.run(func, q, *args, **kwargs)
119 def run(func, q, *args, **kwargs):
120 # func is a closure
121 try:
--> 122 q.put(asyncio.run(func(*args, **kwargs)))
123 except BaseException as e: # noqa: BLE001
124 q.put(e)
File ~/.conda/envs/desc-env/lib/python3.12/asyncio/runners.py:194, in run(main, debug, loop_factory)
190 raise RuntimeError(
191 "asyncio.run() cannot be called from a running event loop")
193 with Runner(debug=debug, loop_factory=loop_factory) as runner:
--> 194 return runner.run(main)
File ~/.conda/envs/desc-env/lib/python3.12/asyncio/runners.py:118, in Runner.run(self, coro, context)
116 self._interrupt_count = 0
117 try:
--> 118 return self._loop.run_until_complete(task)
119 except exceptions.CancelledError:
120 if self._interrupt_count > 0:
File ~/.conda/envs/desc-env/lib/python3.12/asyncio/base_events.py:664, in BaseEventLoop.run_until_complete(self, future)
661 if not future.done():
662 raise RuntimeError('Event loop stopped before Future completed.')
--> 664 return future.result()
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/kaleido/__init__.py:101, in calc_fig(fig, path, opts, topojson, kopts)
99 kopts = kopts or {}
100 kopts["n"] = 1 # should we force this?
--> 101 async with Kaleido(**kopts) as k:
102 return await k.calc_fig(
103 fig,
104 path=path,
105 opts=opts,
106 topojson=topojson,
107 )
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/choreographer/browser_async.py:167, in Browser.__aenter__(self)
165 async def __aenter__(self) -> Self:
166 """Open browser as context to launch on entry and close on exit."""
--> 167 await self.open()
168 return self
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/kaleido/kaleido.py:189, in Kaleido.open(self)
187 page = PageGenerator(plotly=self._plotlyjs, mathjax=self._mathjax)
188 page.generate_index(index)
--> 189 await super().open()
File ~/.conda/envs/desc-env/lib/python3.12/site-packages/choreographer/browser_async.py:157, in Browser.open(self)
152 except (BrowserClosedError, BrowserFailedError, asyncio.CancelledError) as e:
153 if (
154 hasattr(self._browser_impl, "missing_libs")
155 and self._browser_impl.missing_libs
156 ):
--> 157 raise BrowserDepsError from e
158 raise BrowserFailedError(
159 "The browser seemed to close immediately after starting.",
160 "You can set the `logging.Logger` level lower to see more output.",
161 "You may try installing a known working copy of Chrome by running ",
162 "`$ choreo_get_chrome`. It may be your copy auto-updated.",
163 ) from e
BrowserDepsError: It seems like you are running a slim version of your operating system and are missing some common dependencies. The following command should install the required dependencies on most systems:
$ sudo apt update && sudo apt-get install libnss3 libatk-bridge2.0-0 libcups2 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libxkbcommon0 libpango-1.0-0 libcairo2 libasound2
If you have already run the above command and are still seeing this error, or the above command fails, consult the Kaleido documentation for operating system to install chromium dependencies.
For support, run the command `choreo_diagnose` and create an issue with its output.
The output of running choreo_diagnose is given in the attached .txt file. It seems to fail do to uv not being installed which seems like a random/unneeded dependency? I cannot sudo apt update anything on this cluster like the error message seems to say, so I am unsure how to proceed. Thanks!
- Lenguaje dominante
- Python
- Estrellas
- 504
- Forks
- 65
- Merge medio
- 6 d 9 h
- PR fusionados (30 d)
- 2
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de plotly/kaleido
-
Writing to an existing directory whose name has a dot fails with "Invalid format"Posiblemente ocupada @RaphaelFakhri la tomó hace 14 días. Abiertobug P3 size: 1
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
-
Deterministic Rendering ChallengesQuizá libre de nuevo @camdecoster la tomó hace 69 días y no hay ningún pull request abierto. Abiertoenhancement feature P2 size: 5
-
[FEATURE]: Embed custom fonts into vector exports (no system install)Posiblemente ocupada @camdecoster la tomó hace 125 días. Abiertoenhancement P3 size: 3
-
enhancement feature P3 size: 5
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
-
GlobalKaleidoServer is not thread-safePosiblemente ocupada @talleibman la tomó hace 251 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
Todos los issues de plotly/kaleido
Issues similares
-
fuzz fuzz-unconfirmed
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
neilsh/stunt-reel#220 ·
Los mantenedores suelen responder en 1 día
-
[Issue]: use_fp4_cache is accepted but ignored; the launcher always writes FP8 recordsPosiblemente ocupada @0z5a la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area: cli priority: p3 size: S type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
finos/open-resource-broker#757 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 6 días