# Can't install package CuArrays

**URL:** https://discourse.julialang.org/t/cant-install-package-cuarrays/71368
**Category:** General Usage
**Tags:** question, package, cuda
**Created:** [November 12, 2021, 8:39am UTC](https://discourse.julialang.org/t/cant-install-package-cuarrays/71368 "2021-11-12T08:39:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)
#### Post date: [November 12, 2021, 8:39am UTC](https://discourse.julialang.org/t/cant-install-package-cuarrays/71368/1 "2021-11-12T08:39:04Z")

</div>

Dear all,

I am trying to learn CUDA from the book “CUDA by Example” by Sanders and Kandrot. The book is based on C, so I am translating their examples to Julia. I got stuck at their example 3.2.3, which you can see here: [https://github.com/yottaawesome/cuda-by-example/blob/master/src/chapter03/simple\_kernel\_params.cu](https://github.com/yottaawesome/cuda-by-example/blob/master/src/chapter03/simple_kernel_params.cu)

I wrote the Julia counterpart as this:

```julia
using CUDA

function add!(a :: Int64,
              b :: Int64,
              c :: CuDeviceVector{Int64})
  c[1] = a + b
  return nothing
end

function main()

  c = zeros(Int64, 1); # variable on the host
  dev_c = CuArray{Int64}(undef, 1) # variable on the device

  @cuda threads=1 blocks=1 add!(2, 7, dev_c) # call GPU kernel function add!

  c = Array(dev_c) # copy from device's to host
  println("2 + 7 = ", c[1]) # print the result

  CUDA.unsafe_free!(dev_c) # free the memory on the device

end

```

This works as expected, but I don’t like the line: `c = Array(dev_c)`, I find it somehow non-intuitive. Instead, I tried to use `CyArrays.copyto!()`, but I get the error saying `CuArrays` were not defined. Command `using CuArrays` tells me that `CuArrays` were not installed, and suggest me to import the package the usual Julian way. However, importing the package results in the following error:

```julia
ERROR: Unsatisfiable requirements detected for package CUDAapi [3895d2a7]:
 CUDAapi [3895d2a7] log:
 ├─possible versions are: 0.5.0-4.0.0 or uninstalled
 ├─restricted by compatibility requirements with CuArrays [3a865a2d] to versions: 0.5.0-4.0.0
 │ └─CuArrays [3a865a2d] log:
 │ ├─possible versions are: 0.2.1-2.2.2 or uninstalled
 │ └─restricted to versions * by an explicit requirement, leaving only versions 0.2.1-2.2.2
 └─restricted by julia compatibility requirements to versions: uninstalled — no versions left

```

So I wonder: are CuArrays deprecated? How can one use command: `CyArrays.copyto!()`, unless it is deprecated too?

_Cheers_

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [November 12, 2021, 8:54am UTC](https://discourse.julialang.org/t/cant-install-package-cuarrays/71368/2 "2021-11-12T08:54:26Z")

</div>

Which Julia version are you using?

---

<div class="post-metadata">

### Author: ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)
#### Post date: [November 12, 2021, 8:55am UTC](https://discourse.julialang.org/t/cant-install-package-cuarrays/71368/3 "2021-11-12T08:55:40Z")

</div>

1.6.3

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [November 12, 2021, 8:57am UTC](https://discourse.julialang.org/t/cant-install-package-cuarrays/71368/4 "2021-11-12T08:57:54Z")

</div>

That won’t work, see here:

[https://github.com/JuliaRegistries/General/blob/master/C/CUDAapi/Compat.toml](https://github.com/JuliaRegistries/General/blob/master/C/CUDAapi/Compat.toml)

Apparently this is the “old CUDA stack” which shouldn’t be used on Julia \>1.6. So this is probably just a case of an outdated example in the book - if you absolutely want to run it, you’d have to do so on Julia 1.5.4.

---

<div class="post-metadata">

### Author: ![Niceno](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/niceno/32/29648_2.png) [@Niceno](https://discourse.julialang.org/u/Niceno)
#### Post date: [November 12, 2021, 9:01am UTC](https://discourse.julialang.org/t/cant-install-package-cuarrays/71368/5 "2021-11-12T09:01:27Z")

</div>

Thanks!

---

<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: [November 15, 2021, 6:31am UTC](https://discourse.julialang.org/t/cant-install-package-cuarrays/71368/6 "2021-11-15T06:31:58Z")

</div>

> [@Niceno](#):
>
> This works as expected, but I don’t like the line: `c = Array(dev_c)` , I find it somehow non-intuitive. Instead, I tried to use `CyArrays.copyto!()` , but I get the error saying `CuArrays` were not defined.

Just use `copyto!`, there’s no need for a module prefix. The method you want to call is defined by the CUDA module, no need to use any of the old packages (like CuArrays.jl).
