Kaleido._kaleido_tab.JavascriptError is encountered when running Plotly in a docker container
Stack trace indicates this is emanating from:
File â/usr/local/lib/python3.12/site-packages/kaleido/_kaleido_tab.pyâ, line 323, in _calc_fig
raise e
Environment:
- Python 3.12.0
- Plotly 6.1.1
- kaleido 1.0.0
- Acquiring stable Chrome while building the container (this is a MUST, our end-users do not want to access Chrome during run-time- restrictions on Internet use)
- Verified google-chrome and google-chrome-stable are in the /usr/bin directory of container
The plotting is successful when running the code OUTSIDE the container, so this indicates something(s) was/were overlooked or missing in setting up the container??? Any suggestions for trouble-shooting this issue would be appreciated.
Full stack trace:
File â/METviewer-python/METplotpy/metplotpy/plots/base_plot.pyâ, line 376, in save_to_file
self.figure.write_image(image_name)
File â/usr/local/lib/python3.12/site-packages/plotly/basedatatypes.pyâ, line 3911, in write_image
return pio.write_image(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/site-packages/plotly/io/_kaleido.pyâ, line 509, in write_image
img_data = to_image(
^^^^^^^^^
File â/usr/local/lib/python3.12/site-packages/plotly/io/_kaleido.pyâ, line 373, in to_image
img_bytes = kaleido.calc_fig_sync(
^^^^^^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/site-packages/kaleido/init.pyâ, line 145, in calc_fig_sync
return _async_thread_run(calc_fig, args=args, kwargs=kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/site-packages/kaleido/init.pyâ, line 138, in _async_thread_run
raise res
File â/usr/local/lib/python3.12/site-packages/kaleido/init.pyâ, line 129, in run
q.put(asyncio.run(func(*args, **kwargs)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/asyncio/runners.pyâ, line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/asyncio/runners.pyâ, line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/asyncio/base_events.pyâ, line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/site-packages/kaleido/init.pyâ, line 55, in calc_fig
return await k.calc_fig(
^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/site-packages/kaleido/kaleido.pyâ, line 332, in calc_fig
data = await asyncio.wait_for(
^^^^^^^^^^^^^^^^^^^^^^^
File â/usr/local/lib/python3.12/asyncio/tasks.pyâ, line 510, in wait_for
return await fut
^^^^^^^^^
File â/usr/local/lib/python3.12/site-packages/kaleido/_kaleido_tab.pyâ, line 323, in _calc_fig
raise e
kaleido._kaleido_tab.JavascriptError: {âresultâ: {âtypeâ: âobjectâ, âsubtypeâ: âerrorâ, âclassNameâ: âReferenceErrorâ, âdescriptionâ: âReferenceError: Plotly is not defined\n at Object.render [as plotly] (file:///usr/local/lib/python3.12/site-packages/kaleido/vendor/kaleido_scopes.js:3021:18)\n at :1:48â, âobjectIdâ: â-5345872899737574680.1.2â}, âexceptionDetailsâ: {âexceptionIdâ: 2, âtextâ: âUncaughtâ, âlineNumberâ: 3020, âcolumnNumberâ: 17, âscriptIdâ: â8â, âstackTraceâ: {âcallFramesâ: [{âfunctionNameâ: ârenderâ, âscriptIdâ: â8â, âurlâ: âfile:///usr/local/lib/python3.12/site-packages/kaleido/vendor/kaleido_scopes.jsâ, âlineNumberâ: 3020, âcolumnNumberâ: 17}, {âfunctionNameâ: ââ, âscriptIdâ: â12â, âurlâ: ââ, âlineNumberâ: 0, âcolumnNumberâ: 47}]}, âexceptionâ: {âtypeâ: âobjectâ, âsubtypeâ: âerrorâ, âclassNameâ: âReferenceErrorâ, âdescriptionâ: âReferenceError: Plotly is not defined\n at Object.render [as plotly] (file:///usr/local/lib/python3.12/site-packages/kaleido/vendor/kaleido_scopes.js:3021:18)\n at :1:48â, âobjectIdâ: â-5345872899737574680.1.3â}}}
root@045c5ccf62b5:/tmp#