Lukas Euler
08/24/2023, 2:59 PMpull:
- prefect.deployments.steps.git_clone:
id: git_clone
repository: <https://github.com/abc/XYZ.git>
branch: main
access_token: '{{ <http://prefect.blocks.secret.XYZ|prefect.blocks.secret.XYZ>}}'
- prefect.deployments.steps.pip_install_requirements:
directory: '{{ git_clone.directory }}'
requirements_file: requirements.txt
stream_output: False
I obfuscated the repository and the access_token, but since I do get "ModuleNotFoundError: No module named 'pandas'" the code is read fine, but the requirements file isnt.
I've tried to do directory: {{ git_clone.directory }} but when I then try "prefect deploy", I get an error on exactly that lineJamie Zieziula
08/24/2023, 3:29 PMLukas Euler
08/24/2023, 3:36 PMJake Kaplan
08/24/2023, 3:47 PMLukas Euler
08/24/2023, 4:27 PMFlow could not be retrieved from deployment.
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/opt/prefect/xyz/filename.py", line 2, in <module>
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
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 395, in retrieve_flow_then_begin_flow_run
flow = 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 222, 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 91, 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 975, 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 'filename.py' encountered an exception: ModuleNotFoundError("No module named 'pandas'")
This is the script itself:
from prefect import task, flow
import pandas as pd
@task(name="test_pandas", tags=["test"])
def test_pandas():
df = pd.DataFrame({'a': [1, 2, 3]})
return 'done'
@flow(name="Submit to xyz",log_prints=True)
def submit_and_save():
print('start')
test_pandas()
print('done')
Serina
08/24/2023, 4:33 PMrequirements.txt
simply pandas
, or are there other, possibly internal Python package dependencies hosted on that private repo? If it’s not simply pandas
, can you try limiting to that to see what happens?Lukas Euler
08/24/2023, 5:41 PMSerina
08/24/2023, 6:21 PMstream_output=False
like Jake mentioned so that you can see the output of the pip install
🙂Johan sh
09/05/2023, 2:17 PMJohan sh
09/05/2023, 3:02 PMSerina
09/05/2023, 4:06 PMJorge Severino
09/06/2023, 1:22 PMJorge Severino
09/06/2023, 1:24 PMJohan sh
09/06/2023, 1:43 PMJorge Severino
09/06/2023, 2:16 PMJorge Severino
09/06/2023, 7:33 PMJorge Severino
09/06/2023, 8:43 PM