I can't import torch. I'm confused

I can’t import torch. I never faced this issue. Below is the error. I have tried with different version of typing_extension also reinstalled Pytorch with cuda=11.8.

OS : Ubuntu 18.4
GPU : RTX2080
Python : 3.8

Traceback (most recent call last):
File “”, line 1, in
File “/data/studentenv/lib/python3.8/site-packages/torch/init.py”, line 1694, in
_C._initExtension(_manager_path())
File “/data/studentenv/lib/python3.8/site-packages/torch/cuda/init.py”, line 31, in
from .graphs import (
File “/data/studentenv/lib/python3.8/site-packages/torch/cuda/graphs.py”, line 6, in
from torch.utils import _pytree
File “/data/studentenv/lib/python3.8/site-packages/torch/utils/_pytree.py”, line 51, in
from typing_extensions import deprecated
ImportError: cannot import name ‘deprecated’ from ‘typing_extensions’ (/data/studentenv/lib/python3.8/site-packages/typing_extensions.py)

Googling suggests that the issue is similar to:

Could you try installing typing_extensions-4.7.1?

1 Like

@InnovArul Thank you for your reply. Problem solved. Previously I had typing_extensions 4.4.0 and I tried below that versions. Now I installed 4.11. Everything is working fine.