I’m new to Julia and setting up environment.
I installed following packages already.
(@v1.10 ) pkg> status
Status C:\Users\Administrator\.julia\environments\v1.10\Project.toml
[324d7699] CategoricalArrays v0.10.8
[8be319e6] Chain v0.6.0
[a93c6f00] DataFrames v1.6.1
[8197267c] IntervalSets v0.7.10
[ade2ca70] Dates
[8ba89e20] Distributed
[de0858da] Printf
[10745b16] Statistics v1.10.0
However, I’m failing to install packages such as GR, Makie and CairoMakie with the message as following. What should I do to solve this problem?
julia> Pkg.add(“GR”)
Resolving package versions…
Installed x265_jll ─ v3.5.0+0
Failure artifact: x265
Failure artifact: x265
ERROR: Unable to automatically download/install artifact ‘x265’ from sources listed in ‘C:\Users\Administrator.julia\packages\x265_jll\9auB3\Artifacts.toml’.
Sources attempted:
nhz2
August 22, 2024, 3:00pm
2
This error usually happens when anti-virus software somehow interferes with julia installing artifacts. See Artifact folder could not be made on Windows. · Issue #3822 · JuliaLang/Pkg.jl · GitHub for more info.
A quick fix would be to install the packages on julia 1.9 or somehow change your anti-virus settings.
I have a PR that hopefully fixes this issue Retry artifact rename if it fails by nhz2 · Pull Request #4001 · JuliaLang/Pkg.jl · GitHub but I don’t have access to the right computer to test this PR.
2 Likes
Setting the JULIA_DEPOT_PATH to a place not covered by the anti-virus might work.
PS C:> $Env:JULIA_DEPOT_PATH = "R:\depot"
PS C:> R:\tools\juliaup-1.14.9-x86_64-pc-windows-gnu-portable.tar\julia.exe
This ticket also mentions a solution that manually renames the downloaded artifact.
opened 12:46AM - 04 Mar 24 UTC
When running `Pkg.add("CairoMakie")` in an empty project I'm getting this, `Erro… r: "C:\\Users\\meyer\\.julia\\artifacts\\a8244d6d23cbb895fcd39dd3eddb859a0c05d1c6" could not be made`, which I seems to occur as the atomic rename fails after https://github.com/JuliaLang/Pkg.jl/pull/3768.
However, before getting there, I hit https://github.com/JuliaLang/julia/issues/34700, but that could be due to a failure related to above, but the `rm` is in a final block...
To "fix" the problem, I first hacked `Base.rm`
```julia
function Base.rm(path::String; force::Bool=false, recursive::Bool=false)
if !(force && recursive)
return invoke(Base.rm, Tuple{AbstractString}, path; force, recursive)
else
max_attempts = 3
attempts = 0
while attempts < max_attempts
attempts += 1
try
invoke(Base.rm, Tuple{AbstractString}, path; recursive=true, force=true)
catch err
if isa(err, Base.IOError) && attempts < max_attempts
println("Trying again for \"", path, "\"")
attempts == (max_attempts - 1) && sleep(1.0)
continue
else
println("Failed for \"", path, "\"")
rethrow(err)
end
end
end
end
end
```
(but this could just as well be done in `create_artifact`)
And modified `_mv_temp_artifact_dir` (which I couldn't hack since the dispatch is concrete...)
```julia
function _mv_temp_artifact_dir(temp_dir::String, new_path::String)::Nothing
if !isdir(new_path)
# This next step is like
# `mv(temp_dir, new_path)`.
# However, `mv` defaults to `cp` if `rename` returns an error.
# `cp` is not atomic, so avoid the potential of calling it.
err = ccall(:jl_fs_rename, Int32, (Cstring, Cstring), temp_dir, new_path)
# Ignore rename error, but ensure `new_path` exists.
if !isdir(new_path)
println("Just do cp 💀")
mv(temp_dir, new_path)
end
if !isdir(new_path)
error("$(repr(new_path)) could not be made")
end
chmod(new_path, filemode(dirname(new_path)))
set_readonly(new_path)
end
nothing
end
```
`Just do cp 💀` is printed twice, along with a couple of `Trying again for ...`.
In fact, it seems like the `x264_jll` and `Pixman_jll` are the ones that needs retries, not sure if by chance or anything special about these.
Strangely, trying many times, it seemed to work, but fails again if I empty the artifacts folder...
<details> <summary> Versioninfo </summary>
```julia
Julia Version 1.10.2
Commit bd47eca2c8 (2024-03-01 10:14 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 8 × 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, tigerlake)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
Environment:
JULIA_EDITOR = code
JULIA_NUM_THREADS =
```
</details>
Many thanks! I just reinstall Julia v1.9.4 and succeeded to install x265 without any problem.
nhz2
September 2, 2024, 7:58pm
5
This issue should be fixed on Julia nightly now. If you are feeling adventurous, you could delete the “.julia/artifacts” folder and retry installing GR after running.
juliaup add nightly
juliaup up nightly
julia +nightly