Cannot install CUDA.jl on Linux

I’ve been using CUDA.jl on windows so far, today I switched to Manjaro, and installed the julia 1.6.1, and tried to install CUDA.jl.
But there is an error for not founding the lib:

julia> using CUDA
[ Info: Precompiling CUDA [052768ef-5323-5732-b1bb-66c8b64840ba]
ERROR: LoadError: InitError: could not load library "/home/zhangcx93/.julia/artifacts/503611619dce439df9bf3428c01561723188769b/lib/libLLVMExtra-11.so"
libLLVM-11jl.so: cannot open shared object file: No such file or directory
Stacktrace:
 [1] dlopen(s::String, flags::UInt32)
   @ Base.Libc.Libdl ./libdl.jl:114
 [2] macro expansion
   @ ~/.julia/packages/JLLWrappers/bkwIo/src/products/library_generators.jl:54 [inlined]
 [3] __init__()
   @ LLVMExtra_jll ~/.julia/packages/LLVMExtra_jll/DW0cO/src/wrappers/x86_64-linux-gnu-cxx11-julia_version+1.6.0.jl:8
 [4] top-level scope (repeats 2 times)
   @ none:1
during initialization of module LLVMExtra_jll
in expression starting at /home/zhangcx93/.julia/packages/LLVM/aqg20/src/LLVM.jl:1
ERROR: LoadError: Failed to precompile LLVM [929cbde3-209d-540e-8aea-75f648917ca0] to /home/zhangcx93/.julia/compiled/v1.6/LLVM/jl_XFGci6.
Stacktrace:
 [1] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
   @ Base ./loading.jl:1360
 [2] top-level scope (repeats 2 times)
   @ none:1
in expression starting at /home/zhangcx93/.julia/packages/GPUCompiler/wHjqZ/src/GPUCompiler.jl:1
ERROR: LoadError: Failed to precompile GPUCompiler [61eb1bfa-7361-4325-ad38-22787b887f55] to /home/zhangcx93/.julia/compiled/v1.6/GPUCompiler/jl_31kqo0.
Stacktrace:
 [1] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
   @ Base ./loading.jl:1360
 [2] top-level scope (repeats 2 times)
   @ none:1
in expression starting at /home/zhangcx93/.julia/packages/CUDA/02Kjq/src/CUDA.jl:1
ERROR: Failed to precompile CUDA [052768ef-5323-5732-b1bb-66c8b64840ba] to /home/zhangcx93/.julia/compiled/v1.6/CUDA/jl_xnvFXU.
Stacktrace:
 [1] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.TTY, internal_stdout::Base.TTY)
   @ Base ./loading.jl:1360

It’s a fresh install, I tried to purge everything in .julia folder, and the problem remains, there is no any download error.
And aslo I checked the file it claimed not found, it exists, and it has read permission and can be run as program.
I checked other package involve using artifacts, like Plots, it’s working fine.

1 Like

I stumbled upon the same error trying to use ReinforcementLearning.jl on Arch Linux with linux kernel 5.12.15 and Julia 1.6.2 and don’t (yet) know how to fix this.
Precompilation fails because the package LLVM fails to precompile during initialization of module LLVMExtra_jll (as can be seen in your stacktrace, just wanted to confirm this is exactly what i see too).
I’m replying in order for this topic to gain some traction, and maybe someone knowing how to fix this comes around.

I had the same issue on both Manjaro and Arch and I fixed it by installing the aur julia-bin package instead of julia as explained in ERROR: LoadError: InitError: could not load library · Issue #253 · maleadt/LLVM.jl · GitHub

6 Likes

Thank you! Worked for me.