New to managing package dependencies and environments

Hi. I don’t really understand very well how to set up the project.toml file for my package - in particular I don’t understand how to set up package dependencies or use environments. So I have two questions. First, can anyone tell me how to fix the following dependencies problem (see below), and second, where can I find a Packages for Dummies reference to read up on all this?
Thanks!

ERROR: LoadError: The following 2 direct dependencies failed to precompile:

DynamicalSystems --code-coverage=@/home/runner/work/Anatta.jl/Anatta.jl --color=yes --check-bounds=yes --warn-overwrite=yes --depwarn=yes --inline=yes --startup-file=no --track-allocation=none --check-bounds=yes 

Failed to precompile DynamicalSystems [61744808-ddfa-5f27-97ff-6e42cc95d634] to "/home/runner/.julia/compiled/v1.12/DynamicalSystems/jl_JB8saP".

GLMakie --code-coverage=@/home/runner/work/Anatta.jl/Anatta.jl --color=yes --check-bounds=yes --warn-overwrite=yes --depwarn=yes --inline=yes --startup-file=no --track-allocation=none --check-bounds=yes 

Failed to precompile GLMakie [e9467ef8-e4e7-5192-8a1a-b1aee30e663a] to "/home/runner/.julia/compiled/v1.12/GLMakie/jl_jKz8OM".

Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] precompilepkgs(pkgs::Vector{String}; internal_call::Bool, strict::Bool, warn_loaded::Bool, timing::Bool, _from_loading::Bool, configs::Pair{Cmd, Base.CacheFlags}, io::IOContext{Base.PipeEndpoint}, fancyprint::Bool)
    @ Base.Precompilation ./precompilation.jl:372
  [3] (::Pkg.API.var"#227#228"{Bool, Bool, Bool, Bool, Bool, Pair{Cmd, Base.CacheFlags}, Vector{Pkg.Types.PackageSpec}})()
    @ Pkg.API /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:1158
  [4] activate(f::Pkg.API.var"#227#228"{Bool, Bool, Bool, Bool, Bool, Pair{Cmd, Base.CacheFlags}, Vector{Pkg.Types.PackageSpec}}, new_project::String)
    @ Pkg.API /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:1379
  [5] precompile(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; internal_call::Bool, strict::Bool, warn_loaded::Bool, already_instantiated::Bool, timing::Bool, _from_loading::Bool, configs::Pair{Cmd, Base.CacheFlags}, kwargs::@Kwargs{io::Pkg.UnstableIO})
    @ Pkg.API /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:1156
  [6] precompile
    @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:1132 [inlined]
  [7] #precompile#118
    @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:164 [inlined]
  [8] (::Pkg.Operations.var"#132#137"{Base.CacheFlags, Cmd, Pkg.Types.Context})()
    @ Pkg.Operations /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:2049
  [9] activate(f::Pkg.Operations.var"#132#137"{Base.CacheFlags, Cmd, Pkg.Types.Context}, new_project::String)
    @ Pkg.API /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:1379
 [10] (::Pkg.Operations.var"#131#136"{Bool, Cmd, Cmd, Nothing, Pkg.Types.Context, Vector{Tuple{String, Base.Process}}, String, Pkg.Types.PackageSpec})()
    @ Pkg.Operations /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:2048
 [11] withenv(::Pkg.Operations.var"#131#136"{Bool, Cmd, Cmd, Nothing, Pkg.Types.Context, Vector{Tuple{String, Base.Process}}, String, Pkg.Types.PackageSpec}, ::Pair{String, String}, ::Vararg{Pair{String}})
    @ Base ./env.jl:265
 [12] macro expansion
    @ ./logging.jl:113 [inlined]
 [13] (::Pkg.Operations.var"#118#123"{String, Pkg.Types.EnvCache, Bool, Bool, Bool, Pkg.Operations.var"#131#136"{Bool, Cmd, Cmd, Nothing, Pkg.Types.Context, Vector{Tuple{String, Base.Process}}, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec})()
    @ Pkg.Operations /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:1896
 [14] with_temp_env(fn::Pkg.Operations.var"#118#123"{String, Pkg.Types.EnvCache, Bool, Bool, Bool, Pkg.Operations.var"#131#136"{Bool, Cmd, Cmd, Nothing, Pkg.Types.Context, Vector{Tuple{String, Base.Process}}, String, Pkg.Types.PackageSpec}, Pkg.Types.PackageSpec}, temp_env::String)
    @ Pkg.Operations /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:1766
 [15] (::Pkg.Operations.var"#116#121"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#131#136"{Bool, Cmd, Cmd, Nothing, Pkg.Types.Context, Vector{Tuple{String, Base.Process}}, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, String})(tmp::String)
    @ Pkg.Operations /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:1837
 [16] mktempdir(fn::Pkg.Operations.var"#116#121"{Dict{String, Any}, Bool, Bool, Bool, Pkg.Operations.var"#131#136"{Bool, Cmd, Cmd, Nothing, Pkg.Types.Context, Vector{Tuple{String, Base.Process}}, String, Pkg.Types.PackageSpec}, Pkg.Types.Context, Pkg.Types.PackageSpec, String, String}, parent::String; prefix::String)
    @ Base.Filesystem ./file.jl:835
 [17] mktempdir(fn::Function, parent::String)
    @ Base.Filesystem ./file.jl:831
 [18] mktempdir
    @ ./file.jl:831 [inlined]
 [19] #sandbox#115
    @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:1822 [inlined]
 [20] NamedTuple
    @ ./boot.jl:749 [inlined]
 [21] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
    @ Pkg.Operations /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:2040
 [22] test
    @ /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/Operations.jl:1984 [inlined]
 [23] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Vector{String}, test_args::Cmd, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool, kwargs::@Kwargs{io::Pkg.UnstableIO})
    @ Pkg.API /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:475
 [24] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::Pkg.UnstableIO, kwargs::@Kwargs{coverage::Bool, julia_args::Vector{String}, force_latest_compatible_version::Bool})
    @ Pkg.API /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:159
 [25] test(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::@Kwargs{coverage::Bool, julia_args::Vector{String}, force_latest_compatible_version::Bool})
    @ Pkg.API /opt/hostedtoolcache/julia/nightly/x64/share/julia/stdlib/v1.12/Pkg/src/API.jl:174
 [26] top-level scope
    @ ~/work/_actions/julia-actions/julia-runtest/latest/test_harness.jl:15
 [27] include(fname::String)
    @ Main ./sysimg.jl:38
 [28] top-level scope
    @ none:1
in expression starting at /home/runner/work/_actions/julia-actions/julia-runtest/latest/test_harness.jl:7
Error: Process completed with exit code 1.

The toml files will be set up for you by the package manager (except for optional but recommended dependency compatibility bounds). Once you generate a package and activate it as the current environment, then packages you add to that environment will automatically become dependencies of your package.

More info in the links below:

Writing your code (modernjuliaworkflows.github.io)

jkrumbiegel.com - Pkg.jl and Julia Environments for Beginners

5. Creating Packages · Pkg.jl (julialang.org)

3 Likes

Thanks very much, @Nathan_Boyer - that’s really useful information. I’m still struggling to understand where to start with solving the precompilation problems of GLMakie and DynamicalSystems. If it helps, their compatibilities are:

Agents = "5.8.0, 6"
CSV = "0.10"
DataFrames = "1.5.0"
DynamicalSystems = "3.0.0"
GLMakie = "0.8.2, 0.9"
InteractiveDynamics = "0.22"
Makie = "0.19.2, 0.20"
Observables = "0.5.4"
Statistics = "1"
julia = "1.6"

I notice the error message says Julia 1.12. Why are you running the nightly version? Use Julia 1.10.2.

Thanks. So if I understand you rightly, I should either remove the nightly run or change it to use version 1.10.2, yes? How would I do either of those? So far, I’ve just let github do whatever it throught best. :face_with_diagonal_mouth:

OK, got it! I removed the nightly run from CI.yml. But I really must start trying to understand all this job control stuff better. Thanks for your help! :smiley:

Oh, I did not know this is for continuous integration. For a packge of this complexity, it might be some time before Julia nightly is fully compatible with these packages. It’s not a bad idea to add an optional test for this though.

3 Likes

You know, as a beginner - and maybe even more so as someone who is knowledgeable in one area and not in another - it’s not easy to come out and tell others what one doesn’t understand. Because of this, I just love the friendly, helpful and thoughtful atmosphere here on the julia discourse forum. Thank-you very much! :smiley:

1 Like