Yizhe
Yizhe7d ago

Python import randomly fails

Here's my script:
# requirements:
# psd_tools

from psd_tools import PSDImage

def main():
return None
# requirements:
# psd_tools

from psd_tools import PSDImage

def main():
return None
When I execute it, about 60% of the time it fails with the following error messages:
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-default-f609a61209f6-TbLO9/01932967-f3dc-c0f3-6009-2402dacd47c8/wrapper.py", line 10, in <module>
from u.sunyizhe import tougher_script as inner_script
File "/tmp/windmill/wk-default-f609a61209f6-TbLO9/01932967-f3dc-c0f3-6009-2402dacd47c8/u/sunyizhe/tougher_script.py", line 4, in <module>
from psd_tools import PSDImage
ImportError: cannot import name 'PSDImage' from 'psd_tools' (unknown location)
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-default-f609a61209f6-TbLO9/01932967-f3dc-c0f3-6009-2402dacd47c8/wrapper.py", line 10, in <module>
from u.sunyizhe import tougher_script as inner_script
File "/tmp/windmill/wk-default-f609a61209f6-TbLO9/01932967-f3dc-c0f3-6009-2402dacd47c8/u/sunyizhe/tougher_script.py", line 4, in <module>
from psd_tools import PSDImage
ImportError: cannot import name 'PSDImage' from 'psd_tools' (unknown location)
Tweaking #requirement psd_tools doesn't help. Other dependencies don't work as well. I cannot reproduce it reliably.
4 Replies
Yizhe
YizheOP7d ago
Upon further testing, only one of the three workers can import correctly, thus the errors appear random.
rubenf
rubenf7d ago
Do you know why only one of the worker can import correctly?
Yizhe
YizheOP7d ago
The first one to install it. I investigated a bit, and other containers have no read permission to the shared volumn. It seems related to Podman's rootless container stuff I assume that since all the workers have different UID on the host, Windmill's way of sharing dependencies by mounting the same volumn under different containers don't work It's possible that rootless Docker suffers from the same issue. Maybe you should document this surprising behavior?
rubenf
rubenf7d ago
Rather than documenting that behavior, we would probably want to write a full template for different setups such as rootless docker and podman. If you feel like contributing, that could be a great first addition.