# Fail to install x265

**URL:** <https://discourse.julialang.org/t/fail-to-install-x265/118478>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [August 22, 2024, 10:53am UTC](https://discourse.julialang.org/t/fail-to-install-x265/118478 "2024-08-22T10:53:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yongdai](https://avatars.discourse-cdn.com/v4/letter/y/dfb087/32.png) [@Yongdai](https://discourse.julialang.org/u/Yongdai)\
**Post date:** [August 22, 2024, 10:53am UTC](https://discourse.julialang.org/t/fail-to-install-x265/118478/1 "2024-08-22T10:53:16Z")

</div>

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:

- [https://pkg.julialang.org/artifact/da2e0ac84abbe712490f8ee73aca3d512f1eaaab](https://pkg.julialang.org/artifact/da2e0ac84abbe712490f8ee73aca3d512f1eaaab)  
Error: “C:\Users\Administrator\.julia\artifacts\da2e0ac84abbe712490f8ee73aca3d512f1eaaab” could not be made
- [https://github.com/JuliaBinaryWrappers/x265\_jll.jl/releases/download/x265-v3.5.0+0/x265.v3.5.0.x86\_64-w64-mingw32.tar.gz](https://github.com/JuliaBinaryWrappers/x265_jll.jl/releases/download/x265-v3.5.0+0/x265.v3.5.0.x86_64-w64-mingw32.tar.gz)  
Error: “C:\Users\Administrator\.julia\artifacts\da2e0ac84abbe712490f8ee73aca3d512f1eaaab” could not be made

---

<div class="post-metadata">

**Author:** ![nhz2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhz2/32/44428_2.png) [@nhz2](https://discourse.julialang.org/u/nhz2)\
**Post date:** [August 22, 2024, 3:00pm UTC](https://discourse.julialang.org/t/fail-to-install-x265/118478/2 "2024-08-22T15:00:07Z")

</div>

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](https://github.com/JuliaLang/Pkg.jl/issues/3822) 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](https://github.com/JuliaLang/Pkg.jl/pull/4001) but I don’t have access to the right computer to test this PR.

---

<div class="post-metadata">

**Author:** ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Post date:** [August 22, 2024, 3:16pm UTC](https://discourse.julialang.org/t/fail-to-install-x265/118478/3 "2024-08-22T15:16:13Z")

</div>

Setting the JULIA\_DEPOT\_PATH to a place not covered by the anti-virus might work.

```powershell
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.

> <https://github.com/JuliaLang/Pkg.jl/issues/3822#issuecomment-2255318019>
>
> 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\>

---

<div class="post-metadata">

**Author:** ![Yongdai](https://avatars.discourse-cdn.com/v4/letter/y/dfb087/32.png) [@Yongdai](https://discourse.julialang.org/u/Yongdai)\
**Post date:** [August 28, 2024, 7:08am UTC](https://discourse.julialang.org/t/fail-to-install-x265/118478/4 "2024-08-28T07:08:17Z")

</div>

Many thanks! I just reinstall Julia v1.9.4 and succeeded to install x265 without any problem.

---

<div class="post-metadata">

**Author:** ![nhz2](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhz2/32/44428_2.png) [@nhz2](https://discourse.julialang.org/u/nhz2)\
**Post date:** [September 2, 2024, 7:58pm UTC](https://discourse.julialang.org/t/fail-to-install-x265/118478/5 "2024-09-02T19:58:38Z")

</div>

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.

```sh
juliaup add nightly
juliaup up nightly
julia +nightly

```
