Mitch
05/27/2024, 8:21 PMDownloading flow code from storage at '.'
04:21:23 PM
prefect.flow_runs
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "", line 879, in exec_module
File "", line 1016, in get_code
File "", line 1073, in get_data
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp4pi0z171prefect/flows/inspection/base.py'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 424, in retrieve_flow_then_begin_flow_run
else await load_flow_from_flow_run(flow_run, client=client)
File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 271, in load_flow_from_flow_run
flow = await run_sync_in_worker_thread(load_flow_from_entrypoint, str(import_path))
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/prefect/flows.py", line 1551, in load_flow_from_entrypoint
flow = import_object(entrypoint)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 201, in import_object
module = load_script_as_module(script_path)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'flows/inspection/base.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
Marvin
05/27/2024, 8:21 PMI get the following log sometimes when trying to run a pipeline. When I try to rerun the pipeline after it fails, I completes successfully. Why do I get this error, the python version used in my docker image is 3.11?```Downloading flow code from storage at '.' 042123 PM prefect.flow_runs Flow could not be retrieved from deployment. Traceback (most recent call last): File "", line 879, in exec_module File "", line 1016, in get_code File "", line 1073, in get_data FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp4pi0z171prefect/flows/inspection/base.py' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 424, in retrieve_flow_then_begin_flow_run else await load_flow_from_flow_run(flow_run, client=client) File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client return await fn(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 271, in load_flow_from_flow_run
Mitch
05/27/2024, 8:22 PMTraceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 424, in retrieve_flow_then_begin_flow_run
else await load_flow_from_flow_run(flow_run, client=client)
File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 271, in load_flow_from_flow_run
flow = await run_sync_in_worker_thread(load_flow_from_entrypoint, str(import_path))
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/prefect/flows.py", line 1551, in load_flow_from_entrypoint
flow = import_object(entrypoint)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 201, in import_object
module = load_script_as_module(script_path)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'flows/inspection/base.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
Marvin
05/27/2024, 8:22 PMI get the following log sometimes when trying to run a pipeline. When I try to rerun the pipeline after it fails, I completes successfully. Why do I get this error, the python version used in my docker image is 3.11?```Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/prefect/engine.py", line 424, in retrieve_flow_then_begin_flow_run else await load_flow_from_flow_run(flow_run, client=client) File "/usr/local/lib/python3.10/site-packages/prefect/client/utilities.py", line 51, in with_injected_client return await fn(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/prefect/deployments/deployments.py", line 271, in load_flow_from_flow_run flow = await run_sync_in_worker_thread(load_flow_from_entrypoint, str(import_path)) File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread return await anyio.to_thread.run_sync( File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/usr/local/lib/python3.10/site-pack
Mitch
05/27/2024, 8:22 PMFile "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread
return await anyio.to_thread.run_sync(
File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/usr/local/lib/python3.10/site-packages/prefect/flows.py", line 1551, in load_flow_from_entrypoint
flow = import_object(entrypoint)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 201, in import_object
module = load_script_as_module(script_path)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'flows/inspection/base.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
Marvin
05/27/2024, 8:22 PMI get the following log sometimes when trying to run a pipeline. When I try to rerun the pipeline after it fails, I completes successfully. Why do I get this error, the python version used in my docker image is 3.11?``` File "/usr/local/lib/python3.10/site-packages/prefect/utilities/asyncutils.py", line 95, in run_sync_in_worker_thread return await anyio.to_thread.run_sync( File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, *args) File "/usr/local/lib/python3.10/site-packages/prefect/flows.py", line 1551, in load_flow_from_entrypoint flow = import_object(entrypoint) File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 201, in import_object module = load_script_as_module(script_path)
Mitch
05/27/2024, 8:23 PMFile "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 201, in import_object
module = load_script_as_module(script_path)
File "/usr/local/lib/python3.10/site-packages/prefect/utilities/importtools.py", line 164, in load_script_as_module
raise ScriptError(user_exc=exc, path=path) from exc
prefect.exceptions.ScriptError: Script at 'flows/inspection/base.py' encountered an exception: FileNotFoundError(2, 'No such file or directory')
Marvin
05/27/2024, 8:23 PMDockerfile
COPY . /opt/prefect/flows/
WORKDIR /opt/prefect/flows/
2. Version Mismatch:
- Confirm that the Python version in your Docker image is consistent with what Prefect expects. From your traceback, it looks like Python 3.10 is being used, but you mentioned Python 3.11. Verify the Python version in your Docker image and pipelines.
- The Prefect documentation mentions setting up Prefect with a specific Python version here.
3. Handling ScriptError and FileNotFoundError:
- A common issue is the deployment paths and the file locations not aligning. An issue here noted problems with file paths in custom Docker images.
4. CI/CD Configurations:
- Ensure your CI/CD pipeline correctly handles file paths and environment variables across different stages. Prefect has a guide on CI/CD with Docker here.
In summary, address each of these potential issues:
- Double-check file paths in your Docker image.
- Ensure consistent Python versions.
- Properly handle file copying and working directory paths in your Dockerfile.
For further support, you might find this GitHub issue particularly useful, as it closely resembles your situation.Mitch
05/27/2024, 8:36 PM