https://prefect.io logo
#random
Title
# random
p

Patrick Alves

04/06/2022, 1:03 PM
Hi there, I have a local prefect set up thas was running with no error until today. The workflows run in a "local" agent inside a docker container. Today I start to get the error
ModuleNotFoundError: No module named '/root/'
(trackback is on the thread) If I access the agent container and run any flow manually (
python workflows/ad_check/flow.py
) it works! Can someone help me?
a

Anna Geller

04/06/2022, 1:11 PM
could you move the traceback to the thread here to keep the main channel a bit cleaner?
p

Patrick Alves

04/06/2022, 1:14 PM
Yes, sure
Traceback
Copy code
[2022-04-06 12:21:59,542] INFO - worker-local | Deploying flow run 0894e825-81a6-4b84-ad02-5cb21204168b to execution environment...
[2022-04-06 12:21:59,661] INFO - worker-local | Completed deployment of flow run 0894e825-81a6-4b84-ad02-5cb21204168b
No module named '/root/'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.8/site-packages/prefect/__main__.py", line 4, in <module>
    cli()
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/prefect/cli/execute.py", line 96, in flow_run
    raise exc
  File "/usr/local/lib/python3.8/site-packages/prefect/cli/execute.py", line 73, in flow_run
    flow = storage.get_flow(flow_data.name)
  File "/usr/local/lib/python3.8/site-packages/prefect/storage/local.py", line 102, in get_flow
    return extract_flow_from_module(
  File "/usr/local/lib/python3.8/site-packages/prefect/utilities/storage.py", line 126, in extract_flow_from_module
    module = importlib.import_module(mod_name)
  File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named '/root/'
[2022-04-06 12:22:07,401] INFO - worker-local | Process PID 449 returned non-zero exit code 1!
[2022-04-06 12:22:07,402] INFO - worker-local | Process PID 447 returned non-zero exit code 1!
🙏 1
a

Anna Geller

04/06/2022, 1:15 PM
there are a couple of issues here: 1.
ModuleNotFoundError: No module named '/root/'
- do you run your container as a root user? this results in a different Prefect directory 2.
ModuleNotFoundError
indicates that some modules are not packaged correctly - check this thread for more info on how to approach it 3. Generally, to trigger flow runs as Docker containers, it's enough to start a docker agent:
prefect agent docker start
. Prefect will then automatically deploy your flows as Docker containers - no need to do it manually. For more, check out this page
1
p

Patrick Alves

04/06/2022, 1:18 PM
Thanks Anna, I'll check your suggestions
👍 1
10 Views