Skip to content
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

Kaleido not available on windows 11 with julia 1.10 #479

Closed
PetrKryslUCSD opened this issue Jan 3, 2024 · 17 comments
Closed

Kaleido not available on windows 11 with julia 1.10 #479

PetrKryslUCSD opened this issue Jan 3, 2024 · 17 comments

Comments

@PetrKryslUCSD
Copy link

                                                  Julia 1.10 on windows 11.

┌ Warning: Kaleido is not available on this system. Julia will be unable to save images of any plots.
└ @ PlotlyJS C:\Users\pkonl\SublimeJulia_1_10_0\assets.julia-1.10.0-depot\packages\PlotlyJS\qhYQ5\src\kaleido.jl:65
┌ Warning: ErrorException("Could not start Kaleido process")
└ @ PlotlyJS C:\Users\pkonl\SublimeJulia_1_10_0\assets.julia-1.10.0-depot\packages\PlotlyJS\qhYQ5\src\kaleido.jl:66

@montyvesselinov
Copy link

I get the same error!

@RoyiAvital
Copy link

RoyiAvital commented Jan 16, 2024

I have the same issue both on Windows 10 and Windows 11 with Julia 1.10.

I had no issue with Julia 1.9 on Windows 10 (Haven't checked on Windows 11).

@jonathonprehn
Copy link

jonathonprehn commented Jan 17, 2024

Coming in to say that this is happening to me as well using Windows 11, Julia 1.9.2, as well as other versions of Julia. This occurred for both versions 0.18.10, 0.18.11 and 0.18.12 on my machine.

For me it is hanging on this line: https://github.com/JuliaPlots/PlotlyJS.jl/blob/02feab87e848ab89c51b40e47b036e916ec419fa/src/kaleido.jl#L55C17-L55C17

Printing the value of P.stdout for that line results in this, which indicates that it could be hanging because there are no bytes for it to read yet, at least on my machine:
Pipe(Base.Libc.WindowsRawSocket(0xffffffffffffffff) closed => Base.Libc.WindowsRawSocket(0x0000000000000448) open, 0 bytes waiting)

When I run the command it is using outside of the enviroment, which is (I excluded the full artifact path)

kaleido.cmd plotly --disable-gpu --no-sandbox

I get this as output, so Kaleido is on my machine and works correctly as indicated by code == 0, but the output is not being retrieved correctly during initialization.

[0117/104934.901:WARNING:resource_bundle.cc(405)] locale_file_path.empty() for locale [0117/104934.963:WARNING:headless_browser_main_parts.cc(83)] Cannot create Pref Service with no user data dir. {"code": 0, "message": "Success", "result": null, "version": "0.2.1"} [0117/104935.136:ERROR:gpu_init.cc(430)] Passthrough is not supported, GL is swiftshader

Hope this provides useful info.

@RoyiAvital
Copy link

Any additional information could be supplied?
It makes PlotLyJS.jl unusable with 1.10 on Windows.

@jd-foster , Were the issues mentioned in your post at https://discourse.julialang.org/t/105636/5 solved?
It seems they still happen on 0.18.12.

@dtxl
Copy link

dtxl commented Feb 8, 2024

using Plots
using PlotlyBase
using PlotlyKaleido

and using plotly() as backend results in the first run

┌ Warning: backend PlotlyBase is not installed.
└ @ Plots ~/.julia/packages/Plots/HyyIK/src/backends.jl:43
┌ Warning: backend PlotlyKaleido is not installed.
└ @ Plots ~/.julia/packages/Plots/HyyIK/src/backends.jl:43
┌ Warning: _display is not defined for this backend.
└ @ Plots ~/.julia/packages/Plots/HyyIK/src/output.jl:211

although it is installed, but works for further runs on Julia 1.10 and macOS.

@disberd
Copy link
Member

disberd commented Mar 5, 2024

This should be solved now. See the related comment in #473 (comment) for more details.

@disberd disberd closed this as completed Mar 5, 2024
@VivaldoMendes
Copy link

Hi @disberd, I am facing this problem as well, and I did as you suggested here but had no luck.

My old computer at work was replaced by a new one: Windows 11, Julia 1.10.4, Pluto 0.19.45, PlutoPlotly 0.5.0, PlotlyKaleido 2.2.4.

I am not able to save a figure. I get the usual error:

It looks like the Kaleido process is not responding. 
The unresponsive process will be killed, but this means that you will not be able to save figures using `savefig`.

I tried to use the old way: import PlotlyJS :savefig . It used to work, but it does not now. If I do: savefig(p1, "p1.pdf), I get the following error:

MethodError: no method matching savefig(::PlutoPlotly.PlutoPlot, ::String)
Closest candidates are:
savefig(!Matched::Union{PlotlyJS.SyncPlot, PlotlyBase.Plot}, ::AbstractString; format, width, height, scale)
@ PlotlyJS C:\Users\vmpm\.julia\packages\PlotlyJS\b6MbQ\src\kaleido.jl:106

I would appreciate any help. Next month, I will start teaching three courses with Pluto and Julia, and new colleagues are experiencing the same problem. Downgrading Kaleido in the environment did not work: add [email protected]. The downgrading was implemented, but the problem did not go away.

Could it be a problem with permissions? On my home computer (Windows 10), I have no problems with Kaleido.

Thanks

@disberd
Copy link
Member

disberd commented Aug 8, 2024

Hi @VivaldoMendes, do you have a notebook example for reproducing this?

@VivaldoMendes
Copy link

Hi @disberd, thanks for your feedback.

To make sure that nothing was possibly corrupting an existing notebook, I tested this problem by starting a new one from scratch. It has only four cells, and the order is as follows:

begin
	using PlutoPlotly, PlotlyKaleido
	#import PlotlyJS:savefig # I tried with and without this one
	force_pluto_mathjax_local(true)
	PlotlyKaleido.start(;mathjax = true)
end
p1=plot(randn(200))
PlotlyKaleido.start() # I tried with and without this one
savefig(p1, "p1.pdf")

As mentioned, this is occurring in two new computers, both Windows 11 machines, both 23H2 versions (one Home, the other Enterprise ). I think I had this problem in the past on a Windows 10 machine and it was overcome by downgrading to [email protected] . However, this trick is not working now. My problem is that in two courses that will start early September, students need to save plots.

Below, I present aa image of this rather simple notebook.

a

@disberd
Copy link
Member

disberd commented Aug 8, 2024

Thanks for the details @VivaldoMendes, I'll try to check this out tomorrow

@VivaldoMendes
Copy link

@disberd, thanks for your help.

One more detail. If I try to overcome the problem by using the savefig function from PlotlyJS, import PlotlyJS :savefig, I get the following error:

aaa

All packages are installed as the latest versions.

@disberd
Copy link
Member

disberd commented Aug 9, 2024

@VivaldoMendes there are two separate problems that you are facing:

  • The first is that with the Pluto PkgManager you are not able to force the downgrade of Kaleido_jll to v0.1, I believe that you would be able to do so and have things works if you use a local environment rather than a standard notebook one
    • It would be easier if you can share the actual notebook file the next time rather than just the code of the cells, so you also have the project and package manifest embedded
  • The second problem with PlotlyJS: savefig is that PlotlyJS defines its own savefig and does not rely on the one provided by PlotlyKaleido (I guess for legacy reasons, to supports the same savefig signature they had before and that is different from the one in PlotlyKaleido). For this reason, if you use the PlotlyJS.savefig you can't give it the plot from PlutoPlotly directly (in your example, it would work if you did savefig(p1.Plot, "name.pdf"). This however will not likely help you much as the real problem is that you are still using the latest version of the Kaleido artifact in the notebook, which does not work on some windows machines

@VivaldoMendes
Copy link

VivaldoMendes commented Aug 9, 2024

Hi @disberd,

I am not sure if I am following your suggestions correctly. However, I only work with local environments, and I downgraded Kaleido to' [email protected]' in these local environments. Not in the main environment. Should I try it in the main environment as well?

Please find the Pluto notebook with the MWE here

In the environment where this notebook was created, if I type st, I can clearly see the indication that this Kaleido_jll package could be upgraded. So, I think the downgraded was in fact implemented.

Thank you very much

@disberd
Copy link
Member

disberd commented Aug 9, 2024

@VivaldoMendes, notebooks in Pluto do not use local environment if you don't explicitly have a cell with
Pkg.activate(environment_dir), so the notebook example you linked has an embedded environment which uses [email protected].

You can see this if you scroll down in the source of the notebook, where you have the embedded Manifest.toml which contains the following entry:

[[deps.Kaleido_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
git-tree-sha1 = "43032da5832754f58d14a91ffbe86d5f176acda9"
uuid = "f7e6163d-2fa5-5f23-b69c-1db539e41963"
version = "0.2.1+0"

Whatever you have in your local environment is ignored by default by the notebook, and even your main julia environment is not considered by notebook unless you manually disable the integrated package manager in Pluto (with the Pkg.activate cell).

For hacking your way into having the intergarted package manager in the notebook and force kaleido_jll to v0.1, you can paste the following code into an empty notebook:

Notebook Code
# ╔═╡ 571f2495-0098-4a03-b8a6-8589644a7c65
import Pkg

# ╔═╡ 7153ab8e-54b4-11ef-31cc-9d48188d464e
begin
	Pkg.pkg"add [email protected]"
	using PlutoPlotly, PlotlyKaleido
end

# ╔═╡ 5801de3e-f586-4ca4-9ed4-9e31d77cff45
begin
	force_pluto_mathjax_local(true)
	PlotlyKaleido.start(;mathjax = true)
end

# ╔═╡ 9ca65d9a-698d-403e-8dba-2ae4ddb1eeb9
savefig(p1, "p1.pdf")

# ╔═╡ a001adba-3444-4611-8e81-2641450f09fc
p1=plot(randn(200))

Important

For this hack to work, it is important to have the first three cells separated from each other, you need:

  • a cell with import Pkg by itself,
  • a cell which contains Pkg.pkg"add [email protected]" and using PlotlyKaleido (in a begin end),
  • and lastly a cell which calls PlotlyKaleido.start()

The rest of the notebook should work regardless of what to put inside cells

which can be seen in the figure below
image

@VivaldoMendes
Copy link

@disberd , your hack solved my problem, as usual. Thank you so much.

@RoyiAvital
Copy link

I still get:

┌ Warning: It looks like the Kaleido process is not responding. 
│ The unresponsive process will be killed, but this means that you will not be able to save figures using `savefig`.
│ 
│ If you are on Windows this might be caused by known problems with Kaleido v0.2 on Windows (you are using version 0.2.1).
│ You might want to try forcing a downgrade of the Kaleido_jll library to 0.1.
│ Check the Package Readme at https://github.com/JuliaPlots/PlotlyKaleido.jl/tree/main#windows-note for more details.
│ 
│ If you think this is not your case, you might try using a longer timeout to check if the process is not responding (defaults to 10 seconds) by passing the desired value in seconds using the `timeout` kwarg when calling `PlotlyKaleido.start` or `PlotlyKaleido.restart`

On the latest version of PlotlyJS.jl (v0.18.14).

Windows 11 23H2 (Updated) , Julia 1.10.5.

The is the project TOML:

[deps]
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
ColorTypes = "3da002f7-5984-5a60-b8a6-cbb66c0b333f"
FastLapackInterface = "29a986be-02c6-4525-aec4-84b980013641"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19"
Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
OhMyREPL = "5fb14364-9ced-5910-84b2-373655c76a03"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StaticKernels = "4c63dfa8-a427-4548-bd2f-4c19e87a7dc7"

I cleaned .julia\packages, .julia\artifacts and .julia\compiled before instantiating the project.

@disberd
Copy link
Member

disberd commented Sep 13, 2024

@RoyiAvital have you tried specifically adding Kaleido_jll to your Project and putting a compat entry so that it is fixed at v0.1 (as per suggestion in the error message).

Unfortunately the problem with [email protected] on some windows machines is not something we can fix on the julia side (as it's a problem of the C library wrapped by Kaleido_jll).
The best we can do is inform the user of this solution about downgrading to 0.1 on machines with this issue (I never had missing functionalities by using v0.1 of the C library for my use cases).

There has been some recent life in the original kaleido project, and a PR was merged that might fix this problem. Unfortunately no new release was made yet so we still have to wait for a proper solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants