I installed Kaleido today using 'conda install -c conda-forge python-kaleido'. T…he environment I installed it to is running python 3.8.5.
When I attempted to export a Plotly plot I received the following error:
−2
−1.5
−1
−0.5
0
0.5
1
1.5
2
Dupin's Cyclide with Color Corresponding to Mean Curvature
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In [19], line 24
21 if not os.path.exists("images"):
22 os.mkdir("images")
---> 24 sig.write_image("images/sig1.svg")
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/plotly/basedatatypes.py:3829, in BaseFigure.write_image(self, *args, **kwargs)
3769 """
3770 Convert a figure to a static image and write it to a file or writeable
3771 object
(...)
3825 None
3826 """
3827 import plotly.io as pio
-> 3829 return pio.write_image(self, *args, **kwargs)
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/plotly/io/_kaleido.py:267, in write_image(fig, file, format, scale, width, height, validate, engine)
251 raise ValueError(
252 """
253 Cannot infer image type from output path '{file}'.
(...)
261 )
262 )
264 # Request image
265 # -------------
266 # Do this first so we don't create a file if image conversion fails
--> 267 img_data = to_image(
268 fig,
269 format=format,
270 scale=scale,
271 width=width,
272 height=height,
273 validate=validate,
274 engine=engine,
275 )
277 # Open file
278 # ---------
279 if path is None:
280 # We previously failed to make sense of `file` as a pathlib object.
281 # Attempt to write to `file` as an open file descriptor.
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/plotly/io/_kaleido.py:144, in to_image(fig, format, width, height, scale, validate, engine)
141 # Validate figure
142 # ---------------
143 fig_dict = validate_coerce_fig_to_dict(fig, validate)
--> 144 img_bytes = scope.transform(
145 fig_dict, format=format, width=width, height=height, scale=scale
146 )
148 return img_bytes
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/kaleido/scopes/plotly.py:153, in PlotlyScope.transform(self, figure, format, width, height, scale)
142 raise ValueError(
143 "Invalid format '{original_format}'.\n"
144 " Supported formats: {supported_formats_str}"
(...)
148 )
149 )
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 )
157 # Check for export error, later can customize error messages for plotly Python users
158 code = response.get("code", 0)
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/kaleido/scopes/base.py:293, in BaseScope._perform_transform(self, data, **kwargs)
284 """
285 Transform input data using the current scope, returning dict response with error code
286 whether successful or not.
(...)
290 :return: Dict of response from Kaleido executable, whether successful or not
291 """
292 # Ensure that kaleido subprocess is running
--> 293 self._ensure_kaleido()
295 # Perform export
296 export_spec = self._json_dumps(dict(kwargs, data=data)).encode('utf-8')
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/kaleido/scopes/base.py:176, in BaseScope._ensure_kaleido(self)
170 self._std_error = io.BytesIO()
172 # Launch kaleido subprocess
173 # Note: shell=True seems to be needed on Windows to handle executable path with
174 # spaces. The subprocess.Popen docs makes it sound like this shouldn't be
175 # necessary.
--> 176 proc_args = self._build_proc_args()
177 self._proc = subprocess.Popen(
178 proc_args,
179 stdin=subprocess.PIPE,
(...)
182 shell=sys.platform == "win32"
183 )
185 # Set up thread to asynchronously collect standard error stream
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/kaleido/scopes/base.py:123, in BaseScope._build_proc_args(self)
116 def _build_proc_args(self):
117 """
118 Build list of kaleido command-line arguments based on current values of
119 the properties specified by self._scope_flags and self.chromium_args
120
121 :return: list of flags
122 """
--> 123 proc_args = [self.executable_path(), self.scope_name]
124 for k in self._scope_flags:
125 v = getattr(self, k)
File ~/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/kaleido/scopes/base.py:99, in BaseScope.executable_path(cls)
97 path = os.environ.get("PATH", os.defpath)
98 formatted_path = path.replace(os.pathsep, "\n ")
---> 99 raise ValueError(
100 """
101 The kaleido executable is required by the kaleido Python library, but it was not included
102 in the Python package and it could not be found on the system PATH.
103
104 Searched for included kaleido executable at:
105 {vendored_executable_path}
106
107 Searched for executable 'kaleido' on the following system PATH:
108 {formatted_path}\n""".format(
109 vendored_executable_path=vendored_executable_path,
110 formatted_path=formatted_path,
111 )
112 )
114 return executable_path
ValueError:
The kaleido executable is required by the kaleido Python library, but it was not included
in the Python package and it could not be found on the system PATH.
Searched for included kaleido executable at:
/Users/antonechacartegui/opt/anaconda3/envs/pltenv/lib/python3.8/site-packages/kaleido/executable/kaleido
Searched for executable 'kaleido' on the following system PATH:
/Users/antonechacartegui/opt/anaconda3/bin
/Users/antonechacartegui/opt/anaconda3/condabin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Library/TeX/texbin
/opt/X11/bin