Hi <@ULVA73B9P> my deployment on Prefect Cloud has...
# ask-marvin
a
Hi @Marvin my deployment on Prefect Cloud has started crashing when attempting to pull code from my Github repo. It's complaining that uvx can't be found. This started happening today. I've attached the log from the last run, what's going on?
m
thought for 904.4 seconds
Thanks for flagging this — I don’t see the log in this thread, so could you paste the relevant snippet (the lines around the first “uvx: not found” message)? That will help pinpoint where it’s coming from. A few notes and quick checks while we investigate: - Prefect itself does not require
uvx
to pull code from GitHub. Pulling source for
flow.from_source(...)
is done with
git
. If you’re seeing
uvx: not found
, it’s usually coming from your runtime environment (image/machine) or a pre/post step in your project that invokes
uvx
. - Did anything change today in your execution environment? - If you’re using a Serverless work pool, please let me know — we’ve seen a couple of reports today of “uvx not found” in serverless runs due to an environment image change. - If you’re using your own Docker/Kubernetes/Process worker, did the base image or startup script change? To help me help you faster, please share: - Flow run ID (or a link to a failing run) - Work pool type (Serverless, Docker, Kubernetes, Process) - Your deployment’s
from_source
config (URL + entrypoint), and whether you have any pre/post-run commands - The exact error snippet from the logs Workarounds you can apply immediately: - If your repo or startup commands rely on
uvx
, make sure the runtime has it installed. For Docker/K8s workers, add to your image:
Copy code
RUN curl -LsSf <https://astral.sh/uv/install.sh> | sh
  ENV PATH="/root/.local/bin:${PATH}"
For Process workers, install uv on the machine and ensure
uvx
is on PATH. - If you don’t intend to use
uvx
, search your project scripts or deployment steps for any accidental
uvx
calls and replace with
pip
or remove them. - If you’re on Serverless and this started today, pinning to a known-good Docker image in a non-serverless pool (temporarily) or avoiding
uvx
in your steps can unblock you while we confirm the environment change on our side. References: - Prefect 3 deployments from source: Create deployments from source - uv installation docs: uv installation - Latest Prefect releases (in case you pinned a new image today): Prefect releases Once I have the log snippet and your pool type, I can give you a precise fix (and if this is a serverless image regression, I’ll escalate accordingly).
a
@Marvin Here's the complete run log. I deploy using prefect-cloud from within a venv environment. My deploy script has been using uvx, but I've tried removing that, and the same error occurs. There were code changes today, but nothing related to uvx as far as I'm aware. Opening process... 103139 PM Info prefect.flow_runs.runner Running 3 deployment pull step(s) 103140 PM Debug prefect.flow_runs > Running run_shell_script step... 103140 PM Info prefect.flow_runs [Errno 2] No such file or directory: 'uvx' 103140 PM Error prefect.flow_runs Unexpected exception encountered when trying to load flow Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 166, in run_steps step_output = await run_step(step, upstream_outputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 137, in run_step result = await from_async.call_soon_in_new_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 374, in aresult return await asyncio.wrap_future(self.future) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 441, in _run_async result = await coro ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/utility.py", line 176, in run_shell_script async with open_process( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/utilities/processutils.py", line 212, in open_process process = await anyio.open_process(command, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/anyio/_core/_subprocesses.py", line 190, in open_process return await get_async_backend().open_process( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2567, in open_process process = await asyncio.create_subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/subprocess.py", line 224, in create_subprocess_exec transport, protocol = await loop.subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1756, in subprocess_exec transport = await self._make_subprocess_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/unix_events.py", line 211, in _make_subprocess_transport transp = _UnixSubprocessTransport(self, protocol, args, shell, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_subprocess.py", line 36, in init self._start(args=args, shell=shell, stdin=stdin, stdout=stdout, File "/usr/local/lib/python3.12/asyncio/unix_events.py", line 820, in _start self._proc = subprocess.Popen( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.12/subprocess.py", line 1955, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'uvx' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/prefect/engine.py", line 112, in module flow: "Flow[..., Any]" = load_flow(flow_run) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/flow_engine.py", line 150, in load_flow flow = run_coro_as_sync( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 207, in run_coro_as_sync return call.result() ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 365, in result return self.future.result(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 192, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 441, in _run_async result = await coro ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/utilities/asyncutils.py", line 188, in coroutine_wrapper return await task ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/client/utilities.py", line 69, in wrapper return await func(client, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/flows.py", line 2810, in load_flow_from_flow_run output = await run_steps( ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 194, in run_steps raise StepExecutionError(f"Encountered error while running {fqn}") from exc prefect.deployments.steps.core.StepExecutionError: Encountered error while running prefect.deployments.steps.run_shell_script 103140 PM Error prefect.flow_runs Process for flow run 'independent-numbat' exited with status code: 1 103141 PM Error prefect.flow_runs.runner Reported flow run '068cb289-e46f-7073-8000-9371057d02b9' as crashed: Flow run process exited with non-zero status code 1. 103142 PM Info prefect.flow_runs.runner Loading flow to check for on_crashed hooks 103142 PM Info prefect.flow_runs.runner Running 3 deployment pull step(s) 103142 PM Debug prefect.flow_runs > Running run_shell_script step... 103142 PM Info prefect.flow_runs [Errno 2] No such file or directory: 'uvx' 103142 PM Error prefect.flow_runs Runner failed to retrieve flow to execute on_crashed hooks for flow run UUID('068cb289-e46f-7073-8000-9371057d02b9'). Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 166, in run_steps step_output = await run_step(step, upstream_outputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 137, in run_step result = await from_async.call_soon_in_new_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 374, in aresult return await asyncio.wrap_future(self.future) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/_internal/concurrency/calls.py", line 441, in _run_async result = await coro ^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/utility.py", line 176, in run_shell_script async with open_process( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter return await anext(self.gen) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/utilities/processutils.py", line 212, in open_process process = await anyio.open_process(command, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/anyio/_core/_subprocesses.py", line 190, in open_process return await get_async_backend().open_process( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2567, in open_process process = await asyncio.create_subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/subprocess.py", line 224, in create_subprocess_exec transport, protocol = await loop.subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1756, in subprocess_exec transport = await self._make_subprocess_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/unix_events.py", line 211, in _make_subprocess_transport transp = _UnixSubprocessTransport(self, protocol, args, shell, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_subprocess.py", line 36, in init self._start(args=args, shell=shell, stdin=stdin, stdout=stdout, File "/usr/local/lib/python3.12/asyncio/unix_events.py", line 820, in _start self._proc = subprocess.Popen( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/local/lib/python3.12/subprocess.py", line 1955, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'uvx' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/prefect/runner/runner.py", line 1476, in _run_on_crashed_hooks flow = await load_flow_from_flow_run( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/client/utilities.py", line 69, in wrapper return await func(client, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/flows.py", line 2810, in load_flow_from_flow_run output = await run_steps( ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/prefect/deployments/steps/core.py", line 194, in run_steps raise StepExecutionError(f"Encountered error while running {fqn}") from exc prefect.deployments.steps.core.StepExecutionError: Encountered error while running prefect.deployments.steps.run_shell_script 103142 PM Warning prefect.flow_runs.runner
The flow run ID is 068cb289-e46f-7073-8000-9371057d02b9
m
Your message was too long, here's your message at the allowed limit: Here's the complete run log I deploy using prefect-cloud from within a venv environment My deploy script has been using uvx but I've tried removing that and the same error occurs There were code changes today but nothing related to uvx as far as I'm aware Opening process 10 31 39 PM Info prefect flow_runs runner Running 3 deployment pull step(s) 10 31 40 PM Debug prefect flow_runs > Running run_shell_script step 10 31 40 PM Info prefect flow_runs [Errno 2] No such file or directory 'uvx' 10 31 40 PM Error prefect flow_runs Unexpected exception encountered when trying to load flow Traceback (most recent call last) File /usr/local/lib/python3 12/site-packages/prefect/deployments/steps/core py line 166 in run_steps step_output = await run_step(step upstream_outputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/deployments/steps/core py line 137 in run_step result = await from_async call_soon_in_new_thread( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/_internal/concurrency/calls py line 374 in aresult return await asyncio wrap_future(self future) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/_internal/concurrency/calls py line 441 in _run_async result = await coro ^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/deployments/steps/utility py line 176 in run_shell_script async with open_process( ^^^^^^^^^^^^^ File /usr/local/lib/python3 12/contextlib py line 210 in aenter return await anext(self gen) ^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/utilities/processutils py line 212 in open_process process = await anyio open_process(command *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/anyio/_core/_subprocesses py line 190 in open_process return await get_async_backend() open_process( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/anyio/_backends/_asyncio py line 2567 in open_process process = await asyncio create_subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/asyncio/subprocess py line 224 in create_subprocess_exec transport protocol = await loop subprocess_exec( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/asyncio/base_events py line 1756 in subprocess_exec transport = await self _make_subprocess_transport( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/asyncio/unix_events py line 211 in _make_subprocess_transport transp = _UnixSubprocessTransport(self protocol args shell ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/asyncio/base_subprocess py line 36 in init self _start(args=args shell=shell stdin=stdin stdout=stdout File /usr/local/lib/python3 12/asyncio/unix_events py line 820 in _start self _proc = subprocess Popen( ^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/subprocess py line 1026 in init self _execute_child(args executable preexec_fn close_fds File /usr/local/lib/python3 12/subprocess py line 1955 in _execute_child raise child_exception_type(errno_num err_msg err_filename) FileNotFoundError [Errno 2] No such file or directory 'uvx' The above exception was the direct cause of the following exception Traceback (most recent call last) File /usr/local/lib/python3 12/site-packages/prefect/engine py line 112 in <module> flow Flow[ Any] = load_flow(flow_run) ^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/flow_engine py line 150 in load_flow flow = run_coro_as_sync( ^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/utilities/asyncutils py line 207 in run_coro_as_sync return call result() ^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/_internal/concurrency/calls py line 365 in result return self futur
e result(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/_internal/concurrency/calls py line 192 in result return self __get_result() ^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/concurrent/futures/_base py line 401 in __get_result raise self _exception File /usr/local/lib/python3 12/site-packages/prefect/_internal/concurrency/calls py line 441 in _run_async result = await coro ^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/utilities/asyncutils py line 188 in coroutine_wrapper return await task ^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/client/utilities py line 69 in wrapper return await func(client *args *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/flows py line 2810 in load_flow_from_flow_run output = await run_steps( ^^^^^^^^^^^^^^^^ File /usr/local/lib/python3 12/site-packages/prefect/deployments/steps/core py line 194 in run_steps raise StepExecutionError(f Encountered error while running {fqn} ) from exc prefect deployments steps core StepExecutionError Encountered
a
@Marvin I've attached the complete run log. deploy using prefect-cloud from within a venv environment. My deploy script has been using uvx, but I've tried removing that, and the same error occurs. There were code changes today, but nothing related to uvx as far as I'm aware.
m
thought for 276.8 seconds
Thanks for the context — to help zero in, I’ll need a bit more detail since I can’t see the attached log in Slack. Could you paste: - The exact command you’re running to deploy - The exact error message (and ~20 lines before/after where it fails) - Your Prefect version and Python version from the same environment:
Copy code
prefect version
  python -V
- Your entrypoint (e.g.,
./flows/my_flow.py:my_flow
) and any relevant bits of your
prefect.yaml
(name/work_pool/entrypoint/build/push/pull steps) Quick checks that often pinpoint deploy/import issues in Prefect 3.x: 1) Does your flow import cleanly in the same venv?
Copy code
python -c "from pathlib import Path; import importlib.util, sys; p=Path('./path/to/flow.py'); spec=importlib.util.spec_from_file_location('flow_mod', p); m=importlib.util.module_from_spec(spec); spec.loader.exec_module(m); print(getattr(m,'my_flow',None))"
If this fails, the deploy will too. Recent code changes (even outside uvx) commonly trigger import errors during
prefect deploy
because Prefect imports the entrypoint to read parameters/metadata. 2) Confirm you’re on the intended Cloud profile/workspace in the same environment:
Copy code
prefect cloud workspace ls
   prefect cloud workspace set  # if needed
3) Compare versions between uvx and your venv (sometimes they drift): - In venv:
prefect version
- With uvx:
uvx prefect version
Common culprits after code changes - Relative imports or package layout changes causing
ModuleNotFoundError
when run from the project root used by deploy - Top-level side effects (env lookups, network calls) running at import time and failing during
prefect deploy
- Dependency not installed in the venv (deploy imports your module right away) - Entry point path/name mismatch (e.g., file moved or flow function renamed) -
prefect.yaml
out of sync with your code (wrong
entrypoint
, wrong build/push steps) If helpful, I can review your
prefect.yaml
and entrypoint for gotchas. Also, if you tell me where the error occurs in the deploy output (e.g., while “Importing flow…”, “Uploading project…”, “Building image…”) that narrows things quickly. Docs for reference (Prefect 3.x): - Deployments and prefect.yaml: prefect.yaml guide - CLI reference for deploy: prefect deploy CLI Once I see the exact error text and your entrypoint/prefect.yaml, I can pinpoint the fix.
a
@Marvin Prefect version (including Python version): > Version: 3.4.14 > API version: 0.8.4 > Python version: 3.12.3 > Git commit: 9e2d422b > Built: Thu, Aug 21, 2025 04:05 PM > OS/Arch: linux/x86_64 > Profile: prefect-cloud > Server type: cloud > Pydantic version: 2.11.7 > Integrations: > prefect-cloud: 0.1.8 Deploy command (NB this seems to deploy OK, it crashes at runtime): > prefect-cloud deploy orchestrator/run.py:run_proactive --with-requirements requirements.txt --parameter event_payload= > {redacted} --secret TAVILY_API_KEY={redacted} --secret OPENAI_API_KEY={redacted} --secret MEM0_API_KEY={redacted} --secret SMTP_PASS={redacted} --secret SLACK_APP_TOKEN={redacted} --secret SLACK_BOT_TOKEN={redacted} --secret PGPASSWORD='{redacted}' --secret GNEWS_API_KEY="{redacted}" --secret REDDIT_CLIENT_ID="{redacted}" --secret REDDIT_CLIENT_SECRET="{redacted}" --secret REDDIT_USER_AGENT="{redacted}" --env LOG_LEVEL=DEBUG --env PREFECT_LOGGING_LEVEL=DEBUG --env INFERENCE_MODEL="gpt-4.1" --env SMTP_HOST=smtp.gmail.com --env SMTP_PORT=587 --env SMTP_FROM='{redacted}' --env SMTP_USER={redacted} --env SMTP_USE_TLS=true --env SMTP_TIMEOUT_SEC=15 --env PGHOST='{redacted}' --env PGDATABASE='neondb' --env PGUSER='neondb_owner' --env PGSSLMODE='require' --env PGCHANNELBINDING='require' --env PGPORT=5432 --env PG_SHARED_BUFFERS=1GB --env PG_WORK_MEM=64MB --env PG_MAINT_WORK_MEM=512MB --env PG_EFFECTIVE_CACHE_SIZE=3GB --env POSTGRES_USER={redacted} --env POSTGRES_DB=aidb Log excerpt: > 2025-09-17 213140.807392+00:00,20,068cb289-e46f-7073-8000-9371057d02b9,, > Running run_shell_script step... > 2025-09-17 213140.832355+00:00,40,068cb289-e46f-7073-8000-9371057d02b9,,[Errno 2] No such file or directory: 'uvx' > 2025-09-17 213140.833704+00:00,40,068cb289-e46f-7073-8000-9371057d02b9,,"Unexpected exception encountered when trying to load flow > ... > FileNotFoundError: [Errno 2] No such file or directory: 'uvx' The module does import correctly in the same venv. Indeed, it runs perfectly well in my local Prefect install. It's only on Cloud that the run crashes with the 'missing uvx' error. Prefect versions in/out of uvx show slightly diff versions of Pydantic, and diff git vsns: > (venv) ~/agentpoc: prefect version > 101859.374 | DEBUG | prefect.profiles - Using profile 'prefect-cloud' > Version: 3.4.14 > API version: 0.8.4 > Python version: 3.12.3 > Git commit: 9e2d422b > Built: Thu, Aug 21, 2025 04:05 PM > OS/Arch: linux/x86_64 > Profile: prefect-cloud > Server type: cloud > Pydantic version: 2.11.7 > Integrations: > prefect-cloud: 0.1.8 > (venv) ~/agentpoc: uvx prefect version > Installed 93 packages in 35ms > 101910.296 | DEBUG | prefect.profiles - Using profile 'prefect-cloud' > Version: 3.4.18 > API version: 0.8.4 > Python version: 3.12.3 > Git commit: 3baaf4f4 > Built: Fri, Sep 12, 2025 04:03 PM > OS/Arch: linux/x86_64 > Profile: prefect-cloud > Server type: cloud > Pydantic version: 2.11.9 > Server: > Database: sqlite > SQLite version: 3.45.1
m
Your message was too long, here's your message at the allowed limit: Prefect version (including Python version) > Version 3 4 14 > API version 0 8 4 > Python version 3 12 3 > Git commit 9e2d422b > Built Thu Aug 21 2025 04 05 PM > OS/Arch linux/x86_64 > Profile prefect-cloud > Server type cloud > Pydantic version 2 11 7 > Integrations > prefect-cloud 0 1 8 Deploy command (NB this seems to deploy OK it crashes at runtime) > prefect-cloud deploy orchestrator/run py run_proactive --with-requirements requirements txt --parameter event_payload= > {redacted} --secret TAVILY_API_KEY={redacted} --secret OPENAI_API_KEY={redacted} --secret MEM0_API_KEY={redacted} --secret SMTP_PASS={redacted} --secret SLACK_APP_TOKEN={redacted} --secret SLACK_BOT_TOKEN={redacted} --secret PGPASSWORD='{redacted}' --secret GNEWS_API_KEY= {redacted} --secret REDDIT_CLIENT_ID= {redacted} --secret REDDIT_CLIENT_SECRET= {redacted} --secret REDDIT_USER_AGENT= {redacted} --env LOG_LEVEL=DEBUG --env PREFECT_LOGGING_LEVEL=DEBUG --env INFERENCE_MODEL= gpt-4 1 --env SMTP_HOST=<http //smtp gmail com|smtp gmail com> --env SMTP_PORT=587 --env SMTP_FROM='{redacted}' --env SMTP_USER={redacted} --env SMTP_USE_TLS=true --env SMTP_TIMEOUT_SEC=15 --env PGHOST='{redacted}' --env PGDATABASE='neondb' --env PGUSER='neondb_owner' --env PGSSLMODE='require' --env PGCHANNELBINDING='require' --env PGPORT=5432 --env PG_SHARED_BUFFERS=1GB --env PG_WORK_MEM=64MB --env PG_MAINT_WORK_MEM=512MB --env PG_EFFECTIVE_CACHE_SIZE=3GB --env POSTGRES_USER={redacted} --env POSTGRES_DB=aidb Log excerpt > 2025-09-17 21 31 39 264987+00 00 20 068cb289-e46f-7073-8000-9371057d02b9 Opening process > 2025-09-17 21 31 40 796445+00 00 10 068cb289-e46f-7073-8000-9371057d02b9 Running 3 deployment pull step(s) > 2025-09-17 21 31 40 807392+00 00 20 068cb289-e46f-7073-8000-9371057d02b9 > Running run_shell_script step > 2025-09-17 21 31 40 832355+00 00 40 068cb289-e46f-7073-8000-9371057d02b9 [Errno 2] No such file or directory 'uvx' > 2025-09-17 21 31 40 833704+00 00 40 068cb289-e46f-7073-8000-9371057d02b9 Unexpected exception encountered when trying to load flow > Traceback (most recent call last) > File /usr/local/lib/python3 12/site-packages/prefect/deployments/steps/core py line 166 in run_steps > step_output = await run_step(step upstream_outputs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/site-packages/prefect/deployments/steps/core py line 137 in run_step > result = await from_async call_soon_in_new_thread( > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/site-packages/prefect/_internal/concurrency/calls py line 374 in aresult > return await asyncio wrap_future(self future) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/site-packages/prefect/_internal/concurrency/calls py line 441 in _run_async > result = await coro > ^^^^^^^^^^ > File /usr/local/lib/python3 12/site-packages/prefect/deployments/steps/utility py line 176 in run_shell_script > async with open_process( > ^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/contextlib py line 210 in aenter > return await anext(self gen) > ^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/site-packages/prefect/utilities/processutils py line 212 in open_process > process = await anyio open_process(command **kwargs) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/site-packages/anyio/_core/_subprocesses py line 190 in open_process > return await get_async_backend() open_process( > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/site-packages/anyio/_backends/_asyncio py line 2567 in open_process > process = await asyncio create_subprocess_exec( > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/asyncio/subprocess py line 224 in create_subprocess_exec > trans
port protocol = await loop subprocess_exec( > ^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/asyncio/base_events py line 1756 in subprocess_exec > transport = await self _make_subprocess_transport( > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/asyncio/unix_events py line 211 in _make_subprocess_transport > transp = _UnixSubprocessTransport(self protocol args shell > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/asyncio/base_subprocess py line 36 in init > self _start(args=args shell=shell stdin=stdin stdout=stdout > File /usr/local/lib/python3 12/asyncio/unix_events py line 820 in _start > self _proc = subprocess Popen( > ^^^^^^^^^^^^^^^^^ > File /usr/local/lib/python3 12/subprocess py line 1026 in init > self _execute_child(args executable preexec_fn close_fds > File /usr/local/lib/python3 12/subprocess py line 1955 in _execute_child > raise child_exception_type(errno_num err_msg
thought for 158.4 seconds
Thanks — the key clue is this line in your Cloud run log:
Running run_shell_script step...
[Errno 2] No such file or directory: 'uvx'
That means your deployment’s pull/build steps (the ones that run on the worker just before importing your flow) include a run_shell_script that invokes
uvx
. On Prefect Cloud workers,
uvx
is not present by default, so the step fails before your flow imports. This is unrelated to your local venv; Cloud is executing in a clean runtime where
uvx
isn’t installed. Why it still happens after you “removed uvx” - Even if your local deploy command doesn’t mention
uvx
, your deployment spec may still contain a step that calls it. - The
--with-requirements
shortcut you’re using may be implemented as a shell step that runs
uvx ...
in your
prefect-cloud
wrapper. - Result: Cloud side still tries to execute
uvx
and fails. Confirm what steps your deployment has - Run this to see the saved steps Prefect will execute:
Copy code
prefect deployment inspect "<flow-name>/<deployment-name>"
Look for “steps” or a “pull” section and any occurrence of
run_shell_script
or a script starting with
uvx ...
. Two ways to fix it Option A (recommended): Use pip in your pull steps instead of uvx - Define your pull steps explicitly in
prefect.yaml
so the worker installs requirements with pip:
Copy code
deployments:
    - name: run_proactive
      entrypoint: orchestrator/run.py:run_proactive
      work_pool:
        name: <your-pool>
      steps:
        pull:
          - prefect.deployments.steps.pull.set_working_directory:
              directory: .
          - prefect.deployments.steps.utility.pip_install_requirements:
              requirements_file: requirements.txt
- Redeploy:
Copy code
prefect deploy orchestrator/run.py:run_proactive -n run_proactive
- Then trigger a run. This uses pip on the worker and avoids any call to
uvx
. Option B: Keep using uvx by baking it into your worker image - If you control the worker runtime (e.g., Docker work pool), install uv so
uvx
is on PATH. For example in a Dockerfile:
Copy code
# ... your base image
  RUN curl -LsSf <https://astral.sh/uv/install.sh> | sh \
   && ln -s /root/.local/bin/uvx /usr/local/bin/uvx
- Rebuild/push the image, update the work pool’s base image, and redeploy. Now the existing run_shell_script that calls
uvx
will work. If you want to keep using the CLI shortcut - Remove
--with-requirements
from your
prefect-cloud deploy ...
command and let the explicit
pip_install_requirements
step in
prefect.yaml
handle dependency install. That ensures pip is used on Cloud. - If
prefect-cloud deploy
has a way to force pip instead of uvx for the requirements step, use that flag. If not, the explicit step above is the safest. Notes on version drift - The Prefect version and Pydantic drift you saw between local venv and
uvx
installs isn’t the immediate cause of this error. The crash is specifically “command not found: uvx”. - It’s still a good idea to keep Prefect versions aligned between local and Cloud to avoid other surprises. Docs - Prefect 3.x deployments and prefect.yaml: prefect.yaml guide - CLI reference (deploy): prefect deploy CLI If you share the output of:
Copy code
prefect deployment inspect "<flow-name>/<deployment-name>"
I can point to the exact step that’s calling
uvx
and give you a drop-in replacement using
pip_install_requirements
. Also, which work pool/infrastructure are you using (Managed, Process, Docker, Kubernetes)? That determines whether Option A or B is better.
a
@Marvin OK I can see the build pull step that's causing the issue. I'm confused as to why this is present though, as I'm using Managed infra, which I believe doesn't reference my prefect.yaml. In any case my yml file (which I do use for local running) doesn't reference uv/x. Here's the build step section: > 'pull_steps': [ > {'prefect.deployments.steps.run_shell_script': {'id': 'get-github-token', 'script': 'uvx prefect-cloud github token aidan-frntir/agentpoc'}}, > { > 'prefect.deployments.steps.git_clone': { > 'id': 'git-clone', > 'branch': 'main', > 'repository': 'https://x-access-token:{{ get-github-token.stdout }}@github.com/aidan-frntir/agentpoc.git' > } > }, > {'prefect.deployments.steps.run_shell_script': {'script': 'uv pip install -r requirements.txt', 'directory': '{{ git-clone.directory }}'}} > ],
m
thought for 298.1 seconds
Great find — that pull_steps block explains the crash. What’s happening - Managed infra controls the runtime, but it still executes whatever pull/build steps are saved on the deployment before importing your flow. - Those uvx/uv steps were not pulled from your local prefect.yaml. They were baked into the deployment by the command you used to create it (the prefect-cloud wrapper). In particular: - It inserts a run_shell_script to call uvx prefect-cloud github token ... - It clones via a token-substituted URL - It installs with uv pip install -r requirements.txt - On Managed workers, uv/uvx are not present by default, so the run_shell_script step fails before the flow import. Two ways to fix it Option A (recommended): Switch to core prefect deploy and explicit steps that don’t require uv/uvx 1) Define steps in your project’s prefect.yaml so workers use pip, not uv:
Copy code
deployments:
  - name: run_proactive
    entrypoint: orchestrator/run.py:run_proactive
    work_pool:
      name: Managed
    steps:
      pull:
        # If you can provide a GH token as an env var at runtime:
        - prefect.deployments.steps.utility.run_shell_script:
            id: get-github-token
            script: "echo ${GITHUB_TOKEN}"
            expand_env_vars: true
        - prefect.deployments.steps.pull.git_clone:
            id: git-clone
            branch: main
            repository: "<https://x-access-token:{{> get-github-token.stdout }}@github.com/aidan-frntir/agentpoc.git"
        - prefect.deployments.steps.utility.pip_install_requirements:
            requirements_file: requirements.txt
2) Deploy from the project root with core CLI:
Copy code
prefect deploy orchestrator/run.py:run_proactive -n run_proactive
3) Confirm the saved steps:
Copy code
prefect deployment inspect "run_proactive/run_proactive"
There should be no uv/uvx in pull_steps. Option B: Keep the prefect-cloud wrapper, but avoid its uv/uvx helpers - Remove flags that cause it to inject uv/uvx steps (e.g., drop --with-requirements) and/or configure it to use pip instead of uv. If the wrapper doesn’t support that, prefer Option A. - Alternatively, you’d have to ensure uv/uvx exist on the worker image — not feasible with Managed infra. About “Managed infra doesn’t reference my prefect.yaml” - Managed vs Docker/K8s only determines how the run is executed. The deployment’s pull_steps always run on the worker, regardless of infra type. - Whether your deployment uses prefect.yaml depends on how the deployment was created: - core prefect deploy: uses your project’s prefect.yaml - the prefect-cloud wrapper: generates its own steps (what you’re seeing now) Next actions I recommend - Recreate the deployment with core prefect deploy and the YAML above (pip_install_requirements + git_clone), pass GITHUB_TOKEN as an env var when you trigger runs or set it in job variables for the deployment. - Or, if you want to keep using the wrapper, share the exact flags you need and I can suggest the closest equivalent without injecting uv/uvx. References - Prefect YAML guide: prefect.yaml guide - CLI reference: prefect deploy CLI If you want, paste your current prefect.yaml and confirm how you want to provide the GitHub token (env var, Secret block, or Prefect Variable), and I’ll give you a drop-in YAML that avoids uv/uvx.
a
@Marvin OK I'll do that. However... why is it that this deployment method worked fine (and I used it many times over the last few weeks) until yesterday?
m
thought for 47.3 seconds
Short answer: because your deployment spec now contains uv/uvx-based pull steps, and the Managed runtime you’re landing on no longer has uv/uvx on PATH. Before yesterday, either: - The Managed image you hit happened to include uv/uvx (or PATH to it), or - The prefect-cloud wrapper you used to create the deployment was on a prior version that didn’t inject those uv/uvx steps, or used pip instead, or - You were running an older deployment whose pull_steps didn’t use uv/uvx In other words, the break is almost certainly environment/spec drift: - Managed infra does execute the deployment’s saved pull_steps. It doesn’t ignore them. - The “prefect-cloud deploy …” wrapper writes those steps at deploy time; it does not read your local prefect.yaml. If that wrapper updated or if you re-deployed with flags that cause it to add “uvx …” and “uv pip …”, your new runs will fail on Managed where uv/uvx aren’t present. How to confirm what changed - Inspect an older, known-good deployment and compare its pull_steps to the current one:
Copy code
prefect deployment inspect "<old-flow>/<old-deployment>"
  prefect deployment inspect "<new-flow>/<new-deployment>"
If the old one lacks the uvx step (or shows pip instead of uv), that’s your smoking gun. - Also check when the deployment was last “updated” vs when your failures started. A robust path forward (recap) - Stop relying on the wrapper’s injected steps; define explicit, uv-free steps and deploy with core CLI:
Copy code
deployments:
    - name: run_proactive
      entrypoint: orchestrator/run.py:run_proactive
      work_pool:
        name: Managed
      steps:
        pull:
          - prefect.deployments.steps.pull.git_clone:
              id: git-clone
              branch: main
              repository: "<https://github.com/aidan-frntir/agentpoc.git>"
              access_token: "{{ prefect.variables.GITHUB_TOKEN }}"  # or env/Secret
          - prefect.deployments.steps.utility.pip_install_requirements:
              requirements_file: requirements.txt
Then:
Copy code
prefect deploy orchestrator/run.py:run_proactive -n run_proactive
- Or, use code-based storage so no shell token dance is needed:
Copy code
from prefect import flow
  flow.from_source(
      "<https://github.com/aidan-frntir/agentpoc>",
      entrypoint="orchestrator/run.py:run_proactive",
      credentials={"access_token": "<read from Prefect Variable/Secret>"},
  ).deploy(name="run_proactive", work_pool_name="Managed")
- If you insist on the wrapper, drop flags that cause it to inject “uvx …”/“uv pip …”, or confirm it supports a “use pip” mode. Otherwise you’d have to bake uv/uvx into the worker image, which isn’t possible with Managed. Happy to help translate your current deploy into a prefect.yaml with: - git_clone using access_token (from Prefect Variable/Secret or env var) - pip_install_requirements - any env/secrets/parameters you pass today via CLI flags Refs: - Prefect YAML guide: prefect.yaml guide - Deploy CLI: prefect deploy CLI