# Cuda versioning and pytorch compatibility

**URL:** <https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777>\
**Category:** Uncategorized\
**Created:** [October 11, 2023, 9:31pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777 "2023-10-11T21:31:00Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![juanpajedrez3112](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/juanpajedrez3112/32/61357_2.png) [@juanpajedrez3112](https://discuss.pytorch.org/u/juanpajedrez3112)\
**Post date:** [October 11, 2023, 9:31pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/1 "2023-10-11T21:31:00Z")

</div>

hi everyone,

I am pretty new at using pytorch. Currently, I have been trying to understand the concepts of using CUDA for performing better loading data and increasing speed for training models.

I took a look into my system, I currently have an NVIDIA GTX1650 that contains CUDA v-11, yet I see that hasn’t been installed. Normally, when I work in python, I use virtual environments to set all the libraries I use for a project. With pytorch, I saw you can run on the CPU or use CUDA.

Currently, the latest version is pytorch 2.1.0 which goes until CUDA 11.8 or 12.1. I may have a couple of questions regarding how to properly set my graphics card for usage.

1.) Since the drivers say the latest version is CUDA 11. Does that mean I have to download the 11.0 CUDA from NVIDIA? Since other versions would not work?

2.) Pytorch versioning must also meet the highest available CUDA version? In other words, downgrade pytorch 2.1.0?

3.) Is there a better way than installing for local venvs? (Conda for example).

 ![image](https://discuss.pytorch.org/uploads/default/original/3X/d/b/db75e4795959868d803e25f59fc50c64bf11af71.png)

Thank you so much for your time.

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [October 11, 2023, 9:41pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/2 "2023-10-11T21:41:56Z")

</div>

1. No, you don’t need to download a full CUDA toolkit and would only need to install a compatible NVIDIA driver, since PyTorch binaries ship with their own CUDA dependencies. Your current driver should allow you to run the PyTorch binary with CUDA 11.8, but would fail to run the binary with CUDA 12.1 Update 1 as it’s too old.

2. I don’t understand this question, since PyTorch 2.1.0 is the latest release so what do you want to downgrade from?

3. You don’t need to install virtual environments if you want to use a single PyTorch version only.

---

<div class="post-metadata">

**Author:** ![juanpajedrez3112](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/juanpajedrez3112/32/61357_2.png) [@juanpajedrez3112](https://discuss.pytorch.org/u/juanpajedrez3112)\
**Post date:** [October 11, 2023, 9:58pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/3 "2023-10-11T21:58:25Z")

</div>

Hi!

Thank you for the quick response!

For the second question. I meant to go from PyTorch 2.1.0 to (for instance). To 1.8.0.

Thank you !

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [October 11, 2023, 10:17pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/4 "2023-10-11T22:17:43Z")

</div>

Thanks for clarifying. No you don’t need to downgrade PyTorch and can use the latest `2.1.0+cu118` release with your driver.

---

<div class="post-metadata">

**Author:** ![Nawed\_Ali](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/nawed_ali/32/67445_2.png) [@Nawed\_Ali](https://discuss.pytorch.org/u/Nawed_Ali)\
**Post date:** [February 4, 2024, 7:16am UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/5 "2024-02-04T07:16:02Z")

</div>

hey! can you share whether torch 2.2.0 (latest) would support the latest 12.3 update for cuda

Facing this issue -  
Installed CUDA version 12.3 does not match the version torch was compiled with 11.8, unable to compile cuda/cpp extensions without a matching cuda version

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [February 4, 2024, 3:04pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/6 "2024-02-04T15:04:15Z")

</div>

If you want to build a custom CUDA extension, your locally installed CUDA toolkit has to match the one used in the binaries in the major version and ideally should also match the minor version. Different major releases will error out.

---

<div class="post-metadata">

**Author:** ![Mithilesh\_Kumar](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mithilesh_kumar/32/67526_2.png) [@Mithilesh\_Kumar](https://discuss.pytorch.org/u/Mithilesh_Kumar)\
**Post date:** [February 7, 2024, 7:25am UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/7 "2024-02-07T07:25:03Z")

</div>

Hi @ptrblck,

I have ‘NVIDIA T1200 Laptop GPU’ in my laptop. Which version of Cuda and Torch will go hand in hand. I tried installing ‘cuda\_12.3.2\_546.12\_windows’ & ‘cuda\_11.0.2\_451.48\_win10’. But failing at both. I have window 11 installed in my system. Here are my system specifications:

 ![image](https://discuss.pytorch.org/uploads/default/original/3X/1/7/17eae07e083cd0a6a338e35b56fa4ecc2aa6c8ab.png)

Your help would be greatly appriciated.

Regards,  
Mithilesh

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [February 7, 2024, 2:37pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/8 "2024-02-07T14:37:24Z")

</div>

I don’t know what exactly you want to build, but note that your locally installed CUDA toolkit won’t be used unless you want to build PyTorch from source or a custom CUDA extension. Could you thus describe what exactly you want to build?

---

<div class="post-metadata">

**Author:** ![hamedB](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/hamedb/32/35498_2.png) [@hamedB](https://discuss.pytorch.org/u/hamedB)\
**Post date:** [February 10, 2024, 12:37am UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/9 "2024-02-10T00:37:43Z")

</div>

Dear @ptrblck

I try to install pytorch on my local machine via conda command.  
I use the conda command from PyTorch website:

> conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

using above command the conda command remain in a loop. When I remove pytroch-cuda=11.8, the command successfully run and all other lib. are installed.

Next I enter the below command to install pytorch-cuda:

> conda install pytorch-cuda=11.8 -c pytorch -c nvidia

Unfortunately, it is not installed and I receive the following message.

> Collecting package metadata (current\_repodata.json): - WARNING conda.models.version:get\_matcher(542): Using .\* with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 1.7.1._, but conda is ignoring the ._ and treating it as 1.7.1  
> done  
> Solving environment: failed with initial frozen solve. Retrying with flexible solve.  
> Solving environment: failed with repodata from current\_repodata.json, will retry with next repodata source.  
> Solving environment: /

I was wondering whether you could know what would be issue.

thanks

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [February 10, 2024, 1:48am UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/10 "2024-02-10T01:48:01Z")

</div>

I would create a new and clean conda environment as it seem the conflict resolution might either fail or takes too long.

---

<div class="post-metadata">

**Author:** ![hamedB](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/hamedb/32/35498_2.png) [@hamedB](https://discuss.pytorch.org/u/hamedB)\
**Post date:** [February 10, 2024, 12:42pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/11 "2024-02-10T12:42:25Z")

</div>

@ptrblck  
Thanks for your quick reply. The thing is that I have created several new conda env., even I tried removing the whole Anaconda folder and reinstall again Anaconda. However, it did not work. When I enter the command to install pytorch, torchvision, and torchaudio, everything is fine. Once I add pytorch-cuda to this command, or I want to install pytorch-cuda after others, such as pytorch and torchvision, the install command remains in loop and finally stopped with the error

> Solving environment: Killed

One more thing, I have a yml file including pytorch 1.13 and cuda 11.6. It is installed with conda successfully. However, the problem is with new version.

The reason I want to install new pytorch version is because in pytorch 1.13 it seems the output of hook are not stable. And the hook outputs are slightly changed in different running.

Thanks again for your inputs.

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [February 10, 2024, 2:17pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/12 "2024-02-10T14:17:22Z")

</div>

I’ve just installed the latest stable conda package in a new environment and it works fine in [this thread](https://discuss.pytorch.org/t/glibcxx-3-4-30-not-found/196875/5). If `conda` has issues with the conflict resolution or needs too much RAM you could consider using `mamba` which should be faster.

---

<div class="post-metadata">

**Author:** ![varsha1](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/varsha1/32/62637_2.png) [@varsha1](https://discuss.pytorch.org/u/varsha1)\
**Post date:** [March 14, 2024, 12:11pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/14 "2024-03-14T12:11:45Z")

</div>

Hi,

where I can find the details like for a specific cuda version which version of pytorch is compatible  
I have cuda11.4 what should be the pytorch version

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [March 14, 2024, 1:09pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/15 "2024-03-14T13:09:04Z")

</div>

Check my [previous post](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/8) in this thread.

---

<div class="post-metadata">

**Author:** ![Ameneh\_Shamekhi](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ameneh_shamekhi/32/70028_2.png) [@Ameneh\_Shamekhi](https://discuss.pytorch.org/u/Ameneh_Shamekhi)\
**Post date:** [May 15, 2024, 5:25pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/16 "2024-05-15T17:25:17Z")

</div>

Hi,  
I did install cuda and pytorch using this command:  
`"conda install pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.7 -c pytorch -c nvidia"`  
and now I have the following packages on my conda env:  
cuda-cudart 11.7.99 0 nvidia  
cuda-cupti 11.7.101 0 nvidia  
cuda-libraries 11.7.1 0 nvidia  
cuda-nvrtc 11.7.99 0 nvidia  
cuda-nvtx 11.7.91 0 nvidia  
cuda-runtime 11.7.1 0 nvidia  
nvidia-cuda-cupti-cu11 11.7.101 pypi\_0 pypi  
nvidia-cuda-nvrtc-cu11 11.7.99 pypi\_0 pypi  
nvidia-cuda-runtime-cu11 11.7.99 pypi\_0 pypi  
pytorch 2.0.1 py3.8\_cuda11.7\_cudnn8.5.0\_0 pytorch  
pytorch-cuda 11.7 h778d358\_5 pytorch  
pytorch-mutex 1.0 cuda pytorch  
$ conda list | grep ‘torch’  
ffmpeg 4.3 hf484d3e\_0 pytorch  
pytorch 2.0.1 py3.8\_cuda11.7\_cudnn8.5.0\_0 pytorch  
pytorch-cuda 11.7 h778d358\_5 pytorch  
pytorch-mutex 1.0 cuda pytorch  
pytorch-triton 2.1.0+440fd1bf20 pypi\_0 pypi  
torch-tb-profiler 0.4.1 pypi\_0 pypi  
torchaudio 2.1.0.dev20230628+cu118 pypi\_0 pypi  
torchtriton 2.0.0 py38 pytorch  
torchvision 0.16.0.dev20230628+cu118 pypi\_0 pypi  
but I still get the following error:

```auto
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

```

Please let me know if you have any suggestions.

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [May 15, 2024, 5:58pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/17 "2024-05-15T17:58:27Z")

</div>

Which GPU are you using?

---

<div class="post-metadata">

**Author:** ![Ameneh\_Shamekhi](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ameneh_shamekhi/32/70028_2.png) [@Ameneh\_Shamekhi](https://discuss.pytorch.org/u/Ameneh_Shamekhi)\
**Post date:** [May 15, 2024, 6:10pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/18 "2024-05-15T18:10:24Z")

</div>

It’s a t4 machine. Standard NC4as T4 v3

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [May 15, 2024, 6:26pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/19 "2024-05-15T18:26:49Z")

</div>

The release works for me on a T4:

```python
python -c "import torch; print(torch. __version__ ); print(torch.version.cuda); print(torch.cuda.get_device_properties(0)); print(torch.randn(1).cuda())"
2.0.1
11.7
_CudaDeviceProperties(name='Tesla T4', major=7, minor=5, total_memory=15978MB, multi_processor_count=40)
tensor([-0.0716], device='cuda:0')

```

---

<div class="post-metadata">

**Author:** ![Ameneh\_Shamekhi](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ameneh_shamekhi/32/70028_2.png) [@Ameneh\_Shamekhi](https://discuss.pytorch.org/u/Ameneh_Shamekhi)\
**Post date:** [May 15, 2024, 7:13pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/20 "2024-05-15T19:13:58Z")

</div>

I get similar output when I run "python -c “import torch; print(torch. **version** ); print(torch.version.cuda); print(torch.cuda.get\_device\_properties(0)); print(torch.randn(1).cuda())”  
" so what does this error mean:

> [@Ameneh\_Shamekhi](#):
>
> ```auto
> RuntimeError: CUDA error: no kernel image is available for execution on the device
> CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
> For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
> 
> ```

Should I uninstall the normal pytorch (the non cuda version)?

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [May 15, 2024, 8:06pm UTC](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777/21 "2024-05-15T20:06:27Z")

</div>

The error might be raised by another library not building for your GPU architecture as PyTorch itself is able to use your device. You should try to narrow down which line of code fails and which library is used.

[Next page](https://discuss.pytorch.org/t/cuda-versioning-and-pytorch-compatibility/189777.md?page=2)
