I have been playing around with Ross Rotordynamics in JupyterLab 4.2.6 (Python 3.12). It uses Plotly to render interactive images. At first everything worked fine, but something got meshed up and now it doesn’t render the images anymore. I uninstalled / reinstalled several packages used to no avail. I created a new environment and installed just the required packages, but the problem stays the same.
(ross) C:\Users\xxx\AppData\Local\Programs\Python\Python312\ross\Scripts>jupyter --version
Selected Jupyter core packages...
IPython : 8.29.0
ipykernel : 6.29.5
ipywidgets : 8.1.5
jupyter_client : 8.6.3
jupyter_core : 5.7.2
jupyter_server : 2.14.2
jupyterlab : 4.2.6
nbclient : 0.10.0
nbconvert : 7.16.4
nbformat : 5.10.4
notebook : 7.2.2
qtconsole : not installed
traitlets : 5.14.3
Even when I run this I get the same error as I get when try to render even the simplest graphics using Plotly.
import plotly.io as pio
pio.renderers
This results in this error:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[18], line 2
1 import plotly.io as pio
----> 2 pio.renderers
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\_plotly_utils\importers.py:36, in relative_import.<locals>.__getattr__(import_name)
34 rel_module = ".".join(rel_path_parts[:-1])
35 class_name = import_name
---> 36 class_module = importlib.import_module(rel_module, parent_name)
37 return getattr(class_module, class_name)
39 raise AttributeError(
40 "module {__name__!r} has no attribute {name!r}".format(
41 name=import_name, __name__=parent_name
42 )
43 )
File ~\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py:90, in import_module(name, package)
88 break
89 level += 1
---> 90 return _bootstrap._gcd_import(name[level:], package, level)
File <frozen importlib._bootstrap>:1387, in _gcd_import(name, package, level)
File <frozen importlib._bootstrap>:1360, in _find_and_load(name, import_)
File <frozen importlib._bootstrap>:1331, in _find_and_load_unlocked(name, import_)
File <frozen importlib._bootstrap>:935, in _load_unlocked(spec)
File <frozen importlib._bootstrap_external>:995, in exec_module(self, module)
File <frozen importlib._bootstrap>:488, in _call_with_frames_removed(f, *args, **kwds)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\io\_renderers.py:9
5 from packaging.version import Version
7 from plotly import optional_imports
----> 9 from plotly.io._base_renderers import (
10 MimetypeRenderer,
11 ExternalRenderer,
12 PlotlyRenderer,
13 NotebookRenderer,
14 KaggleRenderer,
15 AzureRenderer,
16 ColabRenderer,
17 JsonRenderer,
18 PngRenderer,
19 JpegRenderer,
20 SvgRenderer,
21 PdfRenderer,
22 BrowserRenderer,
23 IFrameRenderer,
24 SphinxGalleryHtmlRenderer,
25 SphinxGalleryOrcaRenderer,
26 CoCalcRenderer,
27 DatabricksRenderer,
28 )
29 from plotly.io._utils import validate_coerce_fig_to_dict
31 ipython = optional_imports.get_module("IPython")
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\io\_base_renderers.py:9
6 from os.path import isdir
8 from plotly import utils, optional_imports
----> 9 from plotly.io import to_json, to_image, write_image, write_html
10 from plotly.io._orca import ensure_server
11 from plotly.io._utils import plotly_cdn_url
File <frozen importlib._bootstrap>:1412, in _handle_fromlist(module, fromlist, import_, recursive)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\_plotly_utils\importers.py:36, in relative_import.<locals>.__getattr__(import_name)
34 rel_module = ".".join(rel_path_parts[:-1])
35 class_name = import_name
---> 36 class_module = importlib.import_module(rel_module, parent_name)
37 return getattr(class_module, class_name)
39 raise AttributeError(
40 "module {__name__!r} has no attribute {name!r}".format(
41 name=import_name, __name__=parent_name
42 )
43 )
File ~\AppData\Local\Programs\Python\Python312\Lib\importlib\__init__.py:90, in import_module(name, package)
88 break
89 level += 1
---> 90 return _bootstrap._gcd_import(name[level:], package, level)
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\plotly\io\_kaleido.py:10
7 try:
8 from kaleido.scopes.plotly import PlotlyScope
---> 10 scope = PlotlyScope()
12 # Compute absolute path to the 'plotly/package_data/' directory
13 root_dir = os.path.dirname(os.path.abspath(plotly.__file__))
File ~\AppData\Local\Programs\Python\Python312\Lib\site-packages\kaleido\scopes\plotly.py:64, in PlotlyScope.__init__(self, plotlyjs, mathjax, topojson, mapbox_access_token, debug, tmp_path, **kwargs)
62 if tmp_path:
63 temp_args = dict(dir=self.tmp_path)
---> 64 elif "snap" in path:
65 temp_path = Path.home()
66 if self.debug:
TypeError: argument of type 'NoneType' is not iterable
When I actually try to render something using Ross Rotordynamics, it gives a similar error as above, but shows the following instead of the image:
Figure({
'data': [{'hoverinfo': 'none',
'line': {'color': 'black', 'dash': 'dashdot', 'width': 3.0},
'mode': 'lines',
'opacity': 0.7,
'showlegend': False,
'type': 'scatter',
'x': [-0.30000000000000004, 1.7999999999999998],
'y': [0, 0]},
{'hoverinfo': 'none',
'marker': {'color': '#ffcc99', 'line': {'color': 'black', 'width': 1.0}, 'opacity': 0.7, 'size': 20},
'mode': 'markers+text',
'showlegend': False,
'text': [0, 1, 2, 3, 4, 5, 6],
'type': 'scatter',
'x': [0.0, 0.25, 0.5, 0.75, 1.0, 1.25, 1.5],
'y': array([0., 0., 0., 0., 0., 0., 0.])},
{'customdata': [[0, 0.05, 0.0, 0.05, 0.0, 0.25, 'Steel'], [0, 0.05,
0.0, 0.05, 0.0, 0.25, 'Steel'], [0, 0.05, 0.0, 0.05,
0.0, 0.25, 'Steel'], [0, 0.05, 0.0, 0.05, 0.0, 0.25,
'Steel'], [0, 0.05, 0.0, 0.05, 0.0, 0.25, 'Steel'],
[0, 0.05, 0.0, 0.05, 0.0, 0.25, 'Steel'], [0, 0.05,
0.0, 0.05, 0.0, 0.25, 'Steel'], [0, 0.05, 0.0, 0.05,
0.0, 0.25, 'Steel'], [0, 0.05, 0.0, 0.05, 0.0, 0.25,
'Steel'], [0, 0.05, 0.0, 0.05, 0.0, 0.25, 'Steel']],
'fill': 'toself',
<cut>
I have no idea how to solve this. Does anyone have a suggestion?