# DiffEqFlux throws a CUDA error on installation

**URL:** <https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212>\
**Category:** GPU\
**Tags:** question, cuda, diffeqflux\
**Created:** [May 22, 2023, 10:48am UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212 "2023-05-22T10:48:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vidianos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vidianos/32/46647_2.png) [@Vidianos](https://discourse.julialang.org/u/Vidianos)\
**Post date:** [May 22, 2023, 10:48am UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212/1 "2023-05-22T10:48:41Z")

</div>

Hello,

I am trying to get into the SciML ecosystem and as such I installed DiffEqFlux. During installation, I get this error

> Blockquote  
> DiffEqFlux [aae7a2af-3d4f-5e19-a356-7da93b79d9d0]  
> │ ┌ Error: Failed to initialize CUDA  
> │ │ exception =  
> │ │ CUDA error (code 100, CUDA\_ERROR\_NO\_DEVICE)  
> │ │ Stacktrace:  
> │ │ [1] throw\_api\_error(res::CUDA.cudaError\_enum)  
> │ │ @ CUDA ~/.julia/packages/CUDA/p5OVK/lib/cudadrv/libcuda.jl:27  
> │ │ [2] macro expansion  
> │ │ @ ~/.julia/packages/CUDA/p5OVK/lib/cudadrv/libcuda.jl:35 [inlined]  
> │ │ [3] cuInit  
> │ │ @ ~/.julia/packages/CUDA/p5OVK/lib/utils/call.jl:26 [inlined]  
> │ │ [4] **init** ()  
> │ │ @ CUDA ~/.julia/packages/CUDA/p5OVK/src/initialization.jl:125  
> │ │ [5] register\_restored\_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)  
> │ │ @ Base ./loading.jl:1074  
> │ │ [6] \_include\_from\_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})  
> │ │ @ Base ./loading.jl:1020  
> │ │ [7] \_tryrequire\_from\_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})  
> │ │ @ Base ./loading.jl:1356  
> │ │ [8] \_require\_search\_from\_serialized(pkg::Base.PkgId, sourcepath::String, build\_id::UInt128)  
> │ │ @ Base ./loading.jl:1459  
> │ │ [9] \_require(pkg::Base.PkgId, env::String)  
> │ │ @ Base ./loading.jl:1748  
> │ │ [10] \_require\_prelocked(uuidkey::Base.PkgId, env::String)  
> │ │ @ Base ./loading.jl:1625  
> │ │ [11] macro expansion  
> │ │ @ ./loading.jl:1613 [inlined]  
> │ │ [12] macro expansion  
> │ │ @ ./lock.jl:267 [inlined]  
> │ │ [13] require(into::Module, mod::Symbol)  
> │ │ @ Base ./loading.jl:1576  
> │ │ [14] include  
> │ │ @ ./Base.jl:457 [inlined]  
> │ │ [15] include\_package\_for\_output(pkg::Base.PkgId, input::String, depot\_path::Vector{String}, dl\_load\_path::Vector{String}, load\_path::Vector{String}, concrete\_deps::Vector{Pair{Base.PkgId, UInt128}}, source::Nothing)  
> │ │ @ Base ./loading.jl:2010  
> │ │ [16] top-level scope  
> │ │ @ stdin:2  
> │ │ [17] eval  
> │ │ @ ./boot.jl:370 [inlined]  
> │ │ [18] include\_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String)  
> │ │ @ Base ./loading.jl:1864  
> │ │ [19] include\_string  
> │ │ @ ./loading.jl:1874 [inlined]  
> │ │ [20] exec\_options(opts::Base.JLOptions)  
> │ │ @ Base ./client.jl:305  
> │ │ [21] \_start()  
> │ │ @ Base ./client.jl:522  
> │ └ @ CUDA ~/.julia/packages/CUDA/p5OVK/src/initialization.jl:127

I googled this issue and it seems to appear when something is wrong with your CUDA installation. Now here is the thing. I have a laptop with an AMD GPU that is not compatible with CUDA. I do not have the CUDA driver installed (as it wouldn’t work with my GPU anyways), and I am assuming that this might be the cause of the error.

I would like to assume that it is possible to use tools like DiffEqFlux without a CUDA compatible GPU, because being locked to a specific GPU vendor to use this tooling doesn’t sound like a sensible decision. But, being fairly new to Julia, I have no clue how to fix this, so I really need your help.

Thanks in advance!  
Vidianos

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 22, 2023, 11:05am UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212/2 "2023-05-22T11:05:39Z")

</div>

> [@Vidianos](#):
>
> I do not have the CUDA driver installed

You do have the CUDA driver installed, otherwise CUDA.jl wouldn’t be able to call `cuInit` and throw a `CUDA_ERROR_NO_DEVICE` error.

---

<div class="post-metadata">

**Author:** ![Vidianos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vidianos/32/46647_2.png) [@Vidianos](https://discourse.julialang.org/u/Vidianos)\
**Post date:** [May 22, 2023, 11:14am UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212/3 "2023-05-22T11:14:03Z")

</div>

If I have it, then Julia tried to install it on its own for this package (which it honestly shouldn’t do by default because not everyone has a compatible GPU). If I try to install it from my package manager for example, it says its not installed, I did check that to make sure it wasn’t installed.

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 22, 2023, 11:55am UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212/4 "2023-05-22T11:55:45Z")

</div>

> [@Vidianos](#):
>
> Julia tried to install it on its own for this package

That’s not possible, as the CUDA driver is installed system-wide (requires admin privileges and a kernel driver).

---

<div class="post-metadata">

**Author:** ![Vidianos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vidianos/32/46647_2.png) [@Vidianos](https://discourse.julialang.org/u/Vidianos)\
**Post date:** [May 22, 2023, 12:06pm UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212/5 "2023-05-22T12:06:34Z")

</div>

That’s what I would assume myself. However, `sudo pacman -S cuda` shows that the package is most definitely not installed. And anyways, the point isn’t if its installed or not. Its that it wouldn’t work regardless and I am asking if it’s possible to use DiffEqFlux without CUDA because it will not work.

---

<div class="post-metadata">

**Author:** ![maleadt](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/maleadt/32/10097_2.png) [@maleadt](https://discourse.julialang.org/u/maleadt)\
**Post date:** [May 22, 2023, 2:21pm UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212/6 "2023-05-22T14:21:37Z")

</div>

> [@Vidianos](#):
>
> However, `sudo pacman -S cuda` shows that the package is most definitely not installed.

You’re looking for the wrong package, `libcuda` is packaged by `nvidia-*` packages.

> [@Vidianos](#):
>
> the point isn’t if its installed or not

It very much is. Packages are generally not expected to function if their requirements aren’t fullfilled. In the case of CUDA.jl, we generally ignore errors if you haven’t installed CUDA, because conditional dependencies weren’t available pre-1.9. However, if you _do_ have the CUDA driver installed, we assume that you want CUDA.jl to work, so we inform you if the package isn’t functional. That’s reasonable, no?

In addition, these errors are non-fatal. They only `@error` and otherwise let module initialization. So DiffEqFlux should be fully functional already.

---

<div class="post-metadata">

**Author:** ![Vidianos](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vidianos/32/46647_2.png) [@Vidianos](https://discourse.julialang.org/u/Vidianos)\
**Post date:** [May 22, 2023, 6:52pm UTC](https://discourse.julialang.org/t/diffeqflux-throws-a-cuda-error-on-installation/99212/7 "2023-05-22T18:52:18Z")

</div>

> You’re looking for the wrong package, `libcuda` is packaged by `nvidia-*` packages.

Oh, I see, its bizarre that there exists a CUDA package but its not the one we are looking for. And equally bizarre the fact I have it installed. I will troubleshoot why and see if I can find it.

> However, if you _do_ have the CUDA driver installed, we assume that you want CUDA.jl to work, so we inform you if the package isn’t functional. That’s reasonable, no?

Yeah, I didn’t think of it like that, it makes sense.

> So DiffEqFlux should be fully functional already.

It actually is, I feel silly for not trying it first and thinking it was broken.

Thanks for your help and patience with me!!
