# How to install Pytorch with cuda support through CondaPkg

**URL:** <https://discourse.julialang.org/t/how-to-install-pytorch-with-cuda-support-through-condapkg/135690>\
**Category:** Machine Learning\
**Created:** [February 16, 2026, 8:02pm UTC](https://discourse.julialang.org/t/how-to-install-pytorch-with-cuda-support-through-condapkg/135690 "2026-02-16T20:02:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [February 16, 2026, 8:02pm UTC](https://discourse.julialang.org/t/how-to-install-pytorch-with-cuda-support-through-condapkg/135690/1 "2026-02-16T20:02:12Z")

</div>

Hi All,

I would like to ask, if anyone knows how to install pytorch with cuda support through CondaPkg. It has to happen that I need to call some language models and I have opted to use `transformers` from HuggingFace, as sad as it can be. But I have spent quite few days figuring out, how to install pytorch with cuda support, because if I do just `] conda add pytorch`, it CondaPkg will install torch without CUDA support. I have ended manually editing `.CondaPkg/pixi.toml`, add line

```julia-auto
[system-requirements]
cuda = "12.4"

```

and than invoking

```julia-auto
~/.julia/artifacts/cefba4912c2b400756d043a2563ef77a0088866b/bin/pixi add pytorch transformers accelerate

```

in the `.CondaPkg` directory. Ugly hack indeed it is, but it made it work at least. But if possible, I would like to know the correct solution.

Thanks for answer.  
Best wishes.

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [February 17, 2026, 9:28pm UTC](https://discourse.julialang.org/t/how-to-install-pytorch-with-cuda-support-through-condapkg/135690/2 "2026-02-17T21:28:15Z")

</div>

There’s nothing in CondaPkg for this directly, no.

Looks like those settings are implemented as [conda virtual packages](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-virtual.html). I wonder if you can add a virtual package in the same way, try `CondaPkg.add("__cuda", version="12.4")`?

If that doesn’t work, we could easily enough add settings to CondaPkg for CUDA versions etc.

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [February 17, 2026, 9:41pm UTC](https://discourse.julialang.org/t/how-to-install-pytorch-with-cuda-support-through-condapkg/135690/3 "2026-02-17T21:41:37Z")

</div>

> **[Available Override Options - System Requirements - Pixi](https://pixi.prefix.dev/dev/workspace/system_requirements/#available-override-options)**
>
> System requirements tell Pixi the system specifications needed to install and run your environment. They ensure that the dependencies match the operating system and hardware of your machine. | Pixi Documentation — Next-gen package manager for...

You can set the environment variable `CONDA_OVERRIDE_CUDA=12.1` which appears to be supported by conda, mamba AND pixi.

---

<div class="post-metadata">

**Author:** ![cjdoris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cjdoris/32/213133_2.png) [@cjdoris](https://discourse.julialang.org/u/cjdoris)\
**Post date:** [February 17, 2026, 10:41pm UTC](https://discourse.julialang.org/t/how-to-install-pytorch-with-cuda-support-through-condapkg/135690/4 "2026-02-17T22:41:03Z")

</div>

You can also just add the `pytorch-gpu` package to your project I think.

---

<div class="post-metadata">

**Author:** ![Tomas\_Pevny](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomas_pevny/32/25466_2.png) [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Post date:** [February 18, 2026, 5:25am UTC](https://discourse.julialang.org/t/how-to-install-pytorch-with-cuda-support-through-condapkg/135690/5 "2026-02-18T05:25:12Z")

</div>

Hi,

thankfor answer. I have tried pytorch-gpu, but that did not work. I will try to other solutions.
