How to know torch version that installed locally in your device

Issue

I want to check torch version in my device using Jupyter Notebook.

I’m used this

import torch
print(torch.__version__)

but it didn’t work and Jupyter notebook raised an error as below

AttributeError                            Traceback (most recent call last)
<ipython-input-8-beb55f24d5ec> in <module>
      1 import torch
----> 2 print(torch.__version__)

AttributeError: module 'torch' has no attribute '__version__'

Is there any command to check torch version using Jupyter notebook?

Solution

enter image description here

I have tried to install new Pytorch version. But, it didn’t work and then I deleted the Pytorch files manually suggested on my command line. Finally, I installed new Pytorch version using conda install pytorch torchvision torchaudio cudatoolkit=11.0 -c pytorch and everything works fine.

This code works well after that.

import torch
print(torch.__version__)

Answered By – Pain

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published