WindmillWWindmill
Powered by
Trung DoanT
Windmill•2y ago•
7 replies
Trung Doan

Cannot import pytorch

Import
torch
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.
WindmillJoin
3,362Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

Python Import Error
SpookyBiscuit40SSpookyBiscuit40 / help
15mo ago
Import API Documentation
AkkarianAAkkarian / help
3y ago
Python import randomly fails
YizheYYizhe / help
16mo ago
Import tasks from files.
alex4oAalex4o / help
2y ago