Repository navigation
Closed
Description
Hello,
I am using plotly's fig.write_image() (plotly 5.24.1) [fig.write_html() works fine]
I am on a work machine, windows 10 enterprise and am boxed in and can only install to my user folder, so that's where I have miniconda installed. However my user folder has a parenthesis in it which likely clashes with some internal shell/batch scripting. Changing the location of the output file to "c:\temp" is still promting the same error.
'c:\Users\MArras' is not recognized as an internal or external command,
operable program or batch file.
Note here that my user folder is: c:\Users\MArras(NL)\ and not c:\Users\MArras
here is the full error dump:
---------------------------------------------------------------------------
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File c:\Users\MArras(NL)\datamore\misc\intensity_pressure\intensity_pressure.py:91
77 fig = plot_results_with_buttons(
78 data_dict,
79 image=crop_image_by_vector(roi_color_full_img, mask),
(...)
86 calib_min="5 bar",
87 )
88 # Show the figure
89 # fig.show()
90 # fig.write_html(pdf.parent / f"{pdf.stem}.html")
---> 91 fig.write_image(Path(r"C:\temp") / f"{pdf.stem}.png")
File c:\Users\MArras(NL)\AppData\Local\miniconda3\envs\datamore\lib\site-packages\plotly\basedatatypes.py:3835, in BaseFigure.write_image(self, *args, **kwargs)
3775 """
3776 Convert a figure to a static image and write it to a file or writeable
3777 object
(...)
3831 None
3832 """
3833 import plotly.io as pio
-> 3835 return pio.write_image(self, *args, **kwargs)
File c:\Users\MArras(NL)\AppData\Local\miniconda3\envs\datamore\lib\site-packages\plotly\io\_kaleido.py:266, in write_image(fig, file, format, scale, width, height, validate, engine)
250 raise ValueError(
251 """
252 Cannot infer image type from output path '{file}'.
(...)
260 )
261 )
263 # Request image
264 # -------------
265 # Do this first so we don't create a file if image conversion fails
--> 266 img_data = to_image(
267 fig,
268 format=format,
269 scale=scale,
270 width=width,
271 height=height,
272 validate=validate,
273 engine=engine,
274 )
276 # Open file
277 # ---------
278 if path is None:
279 # We previously failed to make sense of `file` as a pathlib object.
280 # Attempt to write to `file` as an open file descriptor.
File c:\Users\MArras(NL)\AppData\Local\miniconda3\envs\datamore\lib\site-packages\plotly\io\_kaleido.py:143, in to_image(fig, format, width, height, scale, validate, engine)
140 # Validate figure
141 # ---------------
142 fig_dict = validate_coerce_fig_to_dict(fig, validate)
--> 143 img_bytes = scope.transform(
144 fig_dict, format=format, width=width, height=height, scale=scale
145 )
147 return img_bytes
File c:\Users\MArras(NL)\AppData\Local\miniconda3\envs\datamore\lib\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 c:\Users\MArras(NL)\AppData\Local\miniconda3\envs\datamore\lib\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 c:\Users\MArras(NL)\AppData\Local\miniconda3\envs\datamore\lib\site-packages\kaleido\scopes\base.py:198, in BaseScope._ensure_kaleido(self)
193 if not startup_response_string:
194 message = (
195 "Failed to start Kaleido subprocess. Error stream:\n\n" +
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:
'c:\Users\MArras' is not recognized as an internal or external command,
operable program or batch file.
Activity
ayjayt commentedon Oct 24, 2024
Hi @mmarras
Will you do me a favor and re-install kaleido with
pip install --pre kaleidoThis will install the yet-to-be-release rewrite of kaleido, and this problem may disappear. Fair warning, it is alpha so it may throw a different error.
Either way I think I can help get this resolved today. Thanks!
mmarras commentedon Oct 24, 2024
Different error indeed:
ayjayt commentedon Oct 24, 2024
That is very useful, thank you, I'll get back to you in a couple hours
ayjayt commentedon Oct 24, 2024
@mmarras for context, plotly had to rewrite kaleido because the original strategy was no longer tenable, and I just had you install the new release.
it's in internal testing right now-
I've just fixed the
but I can't speak for what might happen afterwards..
The rewrite requires chrome or chromium installed on the system- the old version bundled it but its huge now and that doesn't work. (let me know if that's a problem)
You can install the development branch directly with:
python3 -m pip install git+https://github.com/plotly/kaleido@devtools/main#subdirectory=src/pyor if you don't mind waiting, I will @ you when a new
--preis pushed to pypi!Thank you so much for your patience and help!
mmarras commentedon Oct 24, 2024
No more error message, but also no image generation. Keeps being busy indefinitely. Chrome 70 is on the system as a managed installation.
ayjayt commentedon Oct 24, 2024
Hi @mmarras, I really apologize about all this...
I've submitted another commit to that branch to allow verbose (very) debugging output, and it can be enabled if the image is written as:
I copied your original post to make that.
I would need that debugging output to help further, and any additional information about the system.
Thank you so much,
mmarras commentedon Oct 31, 2024
Hi sorry, for getting back to this just now.
The folders (browser_path, user_data_dir) are correct, accessible and contain data but it stops right there after 2s of processing it just hangs.
ayjayt commentedon Oct 31, 2024
Hi @mmarras, there are quite a few bugfixes and updates coming out probably EOD today (maybe tomorrow morning), so your issue might get fixed there... also coming with improved debug. I'll ping you when it's ready!
ayjayt commentedon Nov 4, 2024
Hi @mmarras, so there is a new release candidate on pypi for kaleido. (must pass
--pretopipto install it)It includes several bug fixes, several hang fixes, and the option for increasing debug output.
It is currently going through rounds of alpha testing internally, and I'm sure will be even more stable once that is finished.
I appreciate your patience on these issues!
ayjayt commentedon Nov 15, 2024
New version is now main version- many bogs were squashed since this issue started. I wonder if there is an update?
gvwilson commentedon Nov 19, 2024
@mmarras can you please let us know if v1.0.0rc0 fixes your problems?
mmarras commentedon Dec 7, 2024
I can report error persist, i.e. still hangs idefinitly.
gvwilson commentedon Apr 1, 2025
can this one now be closed as out of date?
mmarras commentedon Apr 1, 2025
Let me check.
gvwilson commentedon Apr 29, 2025
closed as no longer relevant