-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The kaleido executable is required by the kaleido Python library, but it was not included #153
Comments
Having this issue as well, suddenly i'm getting this error for scripts that worked fine before |
I ended up installing Orca and using that engine to export my plots. It worked great for me. I'm not sure if this would help you for what you're doing but you might give it a try. |
For me, I uninstalled plotly and kaleido reinstalled latest versions then installed "urbansim" as some vague comment on StackOverflow suggested. Now everything works :D |
I did this, then attempting to install via pip as a last-ditch effort. But it ended up returning "kaleido already satisfied". And now I can generate images. |
I'm using mac 10.14.6 with python 3.10 in a conda environment whose kernel is mapped to a running jupyter notebook from a separate base environment. After installing kaleido via I generated a copy of the kaleido executible in the |
It worked for me as well |
The trouble is with the custom conda environment not being activated upon kernel launch, by standard. |
I had to do two things to solve this problem fully: First, when I tried running a minimally reproducible example using save_image() which calls kaleido, I prefaced with:
but this threw the error
I had to copy the rpytools folder from the reticulate installation (located at: C:\Users\nrhode\Documents\R\win-library\4.1\reticulate\python) to my virtual environment folder listed as number [8] below:
A clue came from: rstudio/keras#615 (comment) This solved the first error.
Next, I attempted a minimal example which threw an error when trying to find the kaleido executable:
Error:
I finally figured out where the Kaleido executables were located on my system (path below) AND that I had to add this path location explicitly to my Windows 10 Environmental variable path: C:\Users\nrhode\AppData\Local\r-miniconda\pkgs\kaleido-core-0.1.0-h8ffe710_0\Library\bin\KaleidoApp This solved the problem. @mnneely @Siel sessionInfo() Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): reticulate::py_list_packages() reticulate::conda_list() |
Worked for me, thanks a lot |
I installed Kaleido today using 'conda install -c conda-forge python-kaleido'. The 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
The text was updated successfully, but these errors were encountered: