-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
Description
Versions
Platform: macOS Catalina 10.15.7
Python: 3.8.5
Plotly: 4.14.3
Kaleido: 0.2.0
Description of the Problem
If kaleido is installed in a virtual environment with spaces in aitspath, an error will be generated. Here's a minimal reproducible example:
import numpy as np
import plotly.graph_objects as go
a = np.arange(10)
fig = go.Figure(go.Scatter(x=a, y=a))
fig.write_image('Foo.pdf')
Running this will produce the following error trace:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-c7394f7c2527> in <module>
----> 1 fig.write_image('Foo.png')
/path with venv with spaces/lib/python3.8/site-packages/plotly/basedatatypes.py in write_image(self, *args, **kwargs)
3804 import plotly.io as pio
3805
-> 3806 return pio.write_image(self, *args, **kwargs)
3807
3808 # Static helpers
/path with venv with spaces/lib/python3.8/site-packages/plotly/io/_kaleido.py in write_image(fig, file, format, scale, width, height, validate, engine)
243 # -------------
244 # Do this first so we don't create a file if image conversion fails
--> 245 img_data = to_image(
246 fig,
247 format=format,
/path with venv with spaces/lib/python3.8/site-packages/plotly/io/_kaleido.py in to_image(fig, format, width, height, scale, validate, engine)
129 # ---------------
130 fig_dict = validate_coerce_fig_to_dict(fig, validate)
--> 131 img_bytes = scope.transform(
132 fig_dict, format=format, width=width, height=height, scale=scale
133 )
/path with venv with spaces/lib/python3.8/site-packages/kaleido/scopes/plotly.py in transform(self, figure, format, width, height, scale)
151 # Transform in using _perform_transform rather than superclass so we can access the full
152 # response dict, including error codes.
--> 153 response = self._perform_transform(
154 figure, format=format, width=width, height=height, scale=scale
155 )
/path with venv with spaces/lib/python3.8/site-packages/kaleido/scopes/base.py in _perform_transform(self, data, **kwargs)
291 """
292 # Ensure that kaleido subprocess is running
--> 293 self._ensure_kaleido()
294
295 # Perform export
/path with venv with spaces/lib/python3.8/site-packages/kaleido/scopes/base.py in _ensure_kaleido(self)
196 self._get_decoded_std_error()
197 )
--> 198 raise ValueError(message)
199 else:
200 startup_response = json.loads(startup_response_string)
ValueError: Failed to start Kaleido subprocess. Error stream:
/path with venv with spaces/lib/python3.8/site-packages/kaleido/executable/kaleido: line 4: cd: /path: No such file or directory
/path with venv with spaces/lib/python3.8/site-packages/kaleido/executable/kaleido: line 5: ./bin/kaleido: No such file or directory
Reactions are currently unavailable