Trung Doan
Trung Doan•8mo ago

Cannot import pytorch

Import torch causing Import Error. Any other packages is fine. The code:
#requirements:
#torch==2.2.1

import torch
def main():
return torch.cuda.is_available()
#requirements:
#torch==2.2.1

import torch
def main():
return torch.cuda.is_available()
The error:
ExecutionErr: ExitCode: 1, last log lines:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/tmp/windmill/wk-gpu-workers-dataserver-T6dCh/018e22e0-61d1-bd67-2925-09cfa5c37e83/wrapper.py", line 9, in <module>
from u.trungdoan import cleanest_script as inner_script
File "/tmp/windmill/wk-gpu-workers-dataserver-T6dCh/018e22e0-61d1-bd67-2925-09cfa5c37e83/u/trungdoan/cleanest_script.py", line 4, in <module>
import torch
File "/tmp/windmill/cache/pip/torch==2.2.1/torch/__init__.py", line 26, in <module>
from ._utils import _import_dotted_name, classproperty
ImportError: cannot import name '_import_dotted_name' from 'torch._utils' (/tmp/windmill/cache/pip/torch==2.2.1/torch/_utils.py)
ExecutionErr: ExitCode: 1, last log lines:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/tmp/windmill/wk-gpu-workers-dataserver-T6dCh/018e22e0-61d1-bd67-2925-09cfa5c37e83/wrapper.py", line 9, in <module>
from u.trungdoan import cleanest_script as inner_script
File "/tmp/windmill/wk-gpu-workers-dataserver-T6dCh/018e22e0-61d1-bd67-2925-09cfa5c37e83/u/trungdoan/cleanest_script.py", line 4, in <module>
import torch
File "/tmp/windmill/cache/pip/torch==2.2.1/torch/__init__.py", line 26, in <module>
from ._utils import _import_dotted_name, classproperty
ImportError: cannot import name '_import_dotted_name' from 'torch._utils' (/tmp/windmill/cache/pip/torch==2.2.1/torch/_utils.py)
It doesn't say why it cannot import, so I don't know where to go from here.
5 Replies
rubenf
rubenf•8mo ago
@Trung Doan are you self-hosted or on cloud ?
Trung Doan
Trung Doan•8mo ago
@rubenf I'm Self hosted
rubenf
rubenf•8mo ago
@Trung Doan I cannot reproduce
rubenf
rubenf•8mo ago
No description
Trung Doan
Trung Doan•8mo ago
Weird... Is there anything you can suggest me to try 🤔 Oops, I think I found the issues, the downloaded package (torch) got corrupted. I just clear the cache and re-download everything and now it works correctly