Attributeerror: Module 'Torch' Has No Attribute '__Version__'

I try to check if torch have been properly installed by script:

    import torch
    print(torch.__version__) 

and have the result: AttributeError: module 'torch' has no attribute 'version'

I've checked if torch is installed in my venv by:

    pip freeze

and it is installed(I tried to install as via conda as via pip as suggested at ):

  • torch==1.7.1+cu110
  • torchaudio==0.7.2
  • torchvision==0.8.2+cu110

Environment:

  • OS: Ubuntu 18.04
  • GPU Geforce RTX 3070
  • Driver version 460.39
  • Cuda Toolkit V11.0.194
  • Cudnn V8.0.5.39
  • Python V3.6.9

Do not understand what's the problem

1

1 Answer

Pytorch has a sub-module called version and from that you can say,
torch.version.__version__

4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

David Miller

David Miller

Executive Financial & Market Analyst

David Miller brings 15 years of experience in global economics, personal finance strategy, and market dynamics. He specializes in turning complex economic trends into actionable insights for everyday readers.

Share this article
Twitter Facebook Pinterest