Precompilation errors while adding self-developed package to another package

Hi folks,
I am still fairly new to Julia… especially to package development. Currently, I am running into an issue while adding a package with some ModelingToolkit model library I developed myself. When I try to precompile I get errors for some dependencies:

I tried instantiate, update, resolve, and removing the folders in the compiled area. I am a bit lost. Do you have any explanations?

Can you share your package? It’s almost impossible to help without specific details.

My educated guess: you’re using Julia v1.10 or older. And the package manager for some reason decided to favour an incredibly old version of FFMPEG.jl which required the super old package BinaryProvider.jl (when resolving an environment there are often several possible solutions and one has to be picked based on some heuristics, but these heuristics aren’t infallibile). One workaround is to add FFMPEG@0.4 to your environment. Another option is to use Julia v1.11, which doesn’t allow installing BinaryProvider at all.

3 Likes

Thank you @giordano ! I guess exactly that is the issue. This is the Project.toml of my package:

name = "MTKWaterRunModels"
uuid = "e8d35126-f144-472a-a14d-eb099e605784"
authors = ["Jonathan Mädler <...> and contributors"]
version = "0.2.1"

[deps]
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"

[compat]
julia = "1.10"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

Still, I am a bit confused why Julia out of the blue chooses to import these old version of the packages. The dependency responsible for this seems to be Plots.jl. So, is this potentially an issue of Plots.jl?

You didn’t show the full environment (]status -m), but presumably you also got an old version of Plots.jl, so another option is to add compat entry for it (which is always a good idea, besides being mandatory for packages in the General registry)

Plots = "1.40"

Side question, why does your package depend on Pkg.jl and Plots.jl at all?

Ah ok :slight_smile: . I did not know about this -m flag for st. Unfortunately, I did the changes on the environment before running st -m. Now, I don’t know how to get back to the status which produced the error… :man_facepalming:

Is there an automatic way to manage the compabitibility entries in the Project.toml?

Your question about Pkg.jl and Plots.jl is also very valid. Pkg.jl was still there from some experimentation during test development. I removed that. I use Plots.jl sometimes during test development to check the qualitative behavior before writing numeric tests. I removed that as well, but I am pretty sure that I will add this again from time to time to develop tests… is there a best practise for this? I was also already thinking about setting up an additional environment for tests to avoid this. Is that the way to go?

Thank you so much for your insides :slight_smile:

You can edit the file manually, but can also use the compat command in Pkg REPL mode, use ]?compat to read the documentation.

1 Like