Julia artifact was not installed correctly

I love artifacts, but I think currently there are somehow fragile.
I am constantly using a certain artifact, which after some time gets automatically deleted and I get an error like:

Artifact "JuliaMono" was not installed correctly. Try `using Pkg; Pkg.instantiate()` to re-install all missing resources.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:33
 [2] _artifact_str(__module__::Module, artifacts_toml::String, name::SubString{String}, path_tail::String, artifact_dict::Dict{String, Any}, hash::Base.SHA1, platform::Base.BinaryPlatforms.Platform, lazyartifacts::Any)
   @ Artifacts ~/Downloads/Apps/julia/julia-1.7.2/share/julia/stdlib/v1.7/Artifacts/src/Artifacts.jl:551
 [3] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Base ./essentials.jl:716
 [4] invokelatest(::Any, ::Any, ::Vararg{Any})
   @ Base ./essentials.jl:714
 [5] top-level scope
   @ ~/Downloads/Apps/julia/julia-1.7.2/share/julia/stdlib/v1.7/Artifacts/src/Artifacts.jl:680

Unfortunately using Pkg; Pkg.instantiate() doesn’t do the trick.
I used to delete the Artifact.toml and reinstall it and that would work, but right now it doesn’t do the job.

I use the ArtifactUtills package because I still find the Pkg API somehow complicated.

Currently I try to run the example but it also throws an error (didn’t used to):

julia> using ArtifactUtils, Artifacts # Artifacts provides the artifact string macro

julia> add_artifact!(
           "Artifacts.toml",
           "JuliaMono",
           "https://github.com/cormullion/juliamono/releases/download/v0.030/JuliaMono.tar.gz",
           force=true,
       )
SHA1("6c460cf2eccecd24499618112adbbe7e403fa1ee")

julia> import Pkg; Pkg.instantiate()

julia> artifact"JuliaMono" #gives the error above

which gives the error above.

The Artifact.toml file is being correctly generated.

If I manually add the folder in ~/julia/artifacts/ then it works normally

I didn’t want to raise an issue in ArtifactsUtils because I suspect that it will not be this package’s problem. My guess would be that Pkg.instantiate() doesn’t really download the artifact, although it should ?

Tested on a clean Julia 1.7.2 environment.

1 Like

I think that we can start filing an issue. I’m on Julia 1.7.1 and have just added

[MathJax]
git-tree-sha1 = "74d0a953af18dcd657e42a5cd95e77d791882528"

    [[MathJax.download]]
    sha256 = "ba979bd15d82065aebea460ed77e4b3fe217ca3a7876cc69606147b85d8fb3ce"
    url = "https://github.com/mathjax/MathJax/archive/refs/tags/3.2.0.tar.gz"

to Artifacts.toml. Here, the sha’s are wrong, but that shouldn’t matter. They are at least different from any other sha that I have in the system.

Next, > instantiate doesn’t show updates and I also cannot use the artifact

julia> artifact"MathJax"
ERROR: Artifact "MathJax" was not installed correctly. Try `using Pkg; Pkg.instantiate()` to re-install all missing resources.

EDIT: Running the same in Julia 1.6 does work. There the artifact gets installed. I’m opening an issue.

EDIT2: https://github.com/JuliaLang/Pkg.jl/issues/2979

1 Like

Can you try pkg> up? That worked for me

For Julia 1.7.2 and the above example

it still doesn’t work no matter if I do ] up