# Different \[compat\] needs on windows vs mac/linux?

**URL:** <https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384>\
**Category:** General Usage\
**Tags:** question, package\
**Created:** [January 2, 2025, 7:13pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384 "2025-01-02T19:13:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haro/32/50411_2.png) [@Haro](https://discourse.julialang.org/u/Haro)\
**Post date:** [January 2, 2025, 7:13pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/1 "2025-01-02T19:13:22Z")

</div>

Hi all! Is there a way to specify different versions of the same package in [compat] based on the OS of the computer running the package?

I’m working on a team to develop a package which has a custom plotting script in it (using PlotlyJS), and while I am running on a Mac, another collaborator is running windows. There is an issue with Kaleido\_jll that is resolved on windows by pinning the version to 0.1.0, so my collaborator used [compat] in the Project.toml to pin Kaleido\_jll to that version. The problem is that this breaks PlotlyJS for me unless I allow Kaleido\_jll to go to version 0.2.1

Is there a way we can resolve this elegantly? Thanks!

---

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [January 2, 2025, 7:36pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/2 "2025-01-02T19:36:14Z")

</div>

The best long-term solution is to submit a PR upstream to Kaleido that fixes the issue and then update the compat bounds in your package to disallow earlier (buggy) versions of Kaleido.

---

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [January 2, 2025, 9:50pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/3 "2025-01-02T21:50:55Z")

</div>

This is unfortunately not so easy for the specific case of Kaleido.

The [original](https://github.com/plotly/Kaleido) Kaleido repository currently works by providing a relatively lightweight binary that can read the plot object from stdin and produces the figure content as output.

Unfortunately the library has been stale since some years and is currently going through a significant rewrite which will be based on a python only wrapper that assumes chrome or chromium to be installed locally (see this error [here](https://github.com/plotly/Kaleido/blob/master/src%2Fpy%2Fkaleido%2Fscopes%2Fplotly.py#L63)).

This means that the eventual new version of kaleido will not be usable anymore using the artifact systems and binary builder (unless serving the chrome executable that way instead of the smaller kaleido binary).

I wonder if at this point it might be worth in the PlotlyKaleido.jl wrapper to use an ad-hoc copy of the Kaleido\_jll 0.1 binary for windows to use on windows systems while still allowing other systems to use the more up to date version of the Kaleido\_jll artifact

---

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [January 2, 2025, 10:22pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/4 "2025-01-02T22:22:17Z")

</div>

🫤 Agreed, with kaleido’s new design, I’m not sure if that could work in Julia with jll’s (besides wholly implementing in Julia/with jlls).

On the off chance this is an [XY problem](https://en.wikipedia.org/wiki/XY_problem), the plotly/kaleido documentation has never explicitly stated that kaleido is only needed for image generation in browserless contexts. If you are displaying plots in a browser (e.g. Jupyter or Blink), you might also investigate calling the javascript `toImage` functions directly (which is ultimately what Kaleido does afaict). The PlotlyJS package has a [to\_image(plt::SyncPlot; kwargs…)](https://github.com/halleysfifthinc/PlotlyJS.jl/blob/7490d4d48193b2c059aa2c98c7d7a0b3d670169e/src/display.jl#L305) function that might\[1\] work for you.

* * *

1. tl;dr The `plt["image"]` observable can’t update until after the Jupyter cell finishes execution, so that function must be called at the end of a cell before you can access the new `plt["image"]` value in a subsequent cell. I am in the process of developing some fixes, but it involves some substantial architectural changes to IJulia and won’t be arriving anytime soon (if ever).

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [January 2, 2025, 11:21pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/5 "2025-01-02T23:21:05Z")

</div>

> [@Haro](#):
>
> Is there a way to specify different versions of the same package in [compat] based on the OS of the computer running the package?

No. The package manager specifically doesn’t allow that, to make package resolution platform-independent, which makes Manifest portable everywhere. The feature you ask would of course be more flexible, but at the cost of making package resolution more complicated and manifests non-portable.

---

<div class="post-metadata">

**Author:** ![Haro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haro/32/50411_2.png) [@Haro](https://discourse.julialang.org/u/Haro)\
**Post date:** [January 3, 2025, 1:00am UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/6 "2025-01-03T01:00:18Z")

</div>

This very well could be could be an XY problem, but I’m not displaying plots in a browser in this case. My main use case is to generate the plots without displaying and then save them to .png

Using Kaleido\_jll version 0.1.0, the first time I call `using PlotlyJS` in the REPL, I get an error `ERROR: InitError: UndefVarError: 'kaleido' not defined` (coming from src/PlotlyKaleido.jl:79). The second time I try `using PlotlyJS` in the REPL it will work, but as soon as I try to use the `savefig()` command, I get a similar error `ERROR: UndefVarError: 'kaleido' not defined` (also coming from src/PlotlyKaleido.jl:79). The only way I found to resolve this was to allow Kaleido\_jll to go to version 0.2.1

So perhaps the solution is actually more like what @disberd described:

> I wonder if at this point it might be worth in the [PlotlyKaleido.jl](https://juliaregistries.github.io/General/packages/redirect_to_repo/PlotlyKaleido) wrapper to use an ad-hoc copy of the Kaleido\_jll 0.1 binary for windows to use on windows systems while still allowing other systems to use the more up to date version of the Kaleido\_jll artifact

---

<div class="post-metadata">

**Author:** ![halleysfifthinc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/halleysfifthinc/32/206280_2.png) [@halleysfifthinc](https://discourse.julialang.org/u/halleysfifthinc)\
**Post date:** [January 3, 2025, 1:34am UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/7 "2025-01-03T01:34:11Z")

</div>

~~What’s your collaborator’s issue on Windows (stacktrace if possible/relevant) that is in Kaleido\_jll@v0.2.1 but not Kaleido\_jll@v0.1.0?~~ Reading now.

Your collaborator should be able to locally pin the Kaleido version without setting a compat bound (that affects you/everyone else).

---

<div class="post-metadata">

**Author:** ![disberd](https://avatars.discourse-cdn.com/v4/letter/d/8edcca/32.png) [@disberd](https://discourse.julialang.org/u/disberd)\
**Post date:** [January 3, 2025, 1:45pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/8 "2025-01-03T13:45:30Z")

</div>

I made a PR to PlotlyKaleido to implement my suggestion [Manually use Kaleido@v0.1 on windows with explicit artifact by disberd · Pull Request #25 · JuliaPlots/PlotlyKaleido.jl · GitHub](https://github.com/JuliaPlots/PlotlyKaleido.jl/pull/25)

It seems to make windows CI tests pass but maybe you could try checking out that branch to see if it solves your issues

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [January 4, 2025, 12:14pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/9 "2025-01-04T12:14:30Z")

</div>

I encourage everyone to try this out prior to me merging it, since I don’t have a windows machine to test. For that regard I am giving it a week before I merge.

---

<div class="post-metadata">

**Author:** ![Haro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haro/32/50411_2.png) [@Haro](https://discourse.julialang.org/u/Haro)\
**Post date:** [January 10, 2025, 3:34pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/10 "2025-01-10T15:34:56Z")

</div>

I’m not sure my collaborator has had time to test it, could you hold off for a little more?

---

<div class="post-metadata">

**Author:** ![BeastyBlacksmith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/beastyblacksmith/32/4741_2.png) [@BeastyBlacksmith](https://discourse.julialang.org/u/BeastyBlacksmith)\
**Post date:** [January 10, 2025, 5:32pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/11 "2025-01-10T17:32:47Z")

</div>

Ok

---

<div class="post-metadata">

**Author:** ![Haro](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/haro/32/50411_2.png) [@Haro](https://discourse.julialang.org/u/Haro)\
**Post date:** [January 13, 2025, 3:40pm UTC](https://discourse.julialang.org/t/different-compat-needs-on-windows-vs-mac-linux/124384/12 "2025-01-13T15:40:42Z")

</div>

My collaborator reported that they tried the branch on their windows machine and it seemed to work. So I think you’re ok to merge. Thanks so much!
