https://prefect.io logo
#prefect-community
Title
# prefect-community
a

Aisha Merhebi

09/26/2022, 11:56 AM
Hello am getting this error when i run a deployment
โœ… 1
j

Jeff Hale

09/26/2022, 12:39 PM
Hi Aisaha. Could you please move the traceback to this thread to keep the main channel clean? ๐Ÿ™‚ Are you running your agent in an environment that has Python installed? Are you able to share details on where the code is running and a minimum reproducible example of what command and code youโ€™re running?
a

Aisha Merhebi

09/26/2022, 12:43 PM
Copy code
4:56:10.590 | ERROR   | prefect.agent - Failed to submit flow run 'b459f41b-5bee-4506-9233-1e8159a4dc60' to infrastructure.
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/agent.py", line 199, in submit_run
    await self.task_group.start(submit_flow_run, flow_run, infrastructure)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in start
    return await future
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/infrastructure/submission.py", line 48, in submit_flow_run
    return await infrastructure.run(task_status=task_status)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/infrastructure/process.py", line 66, in run
    process = await run_process(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/utilities/processutils.py", line 65, in run_process
    async with open_process(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/prefect/utilities/processutils.py", line 28, in open_process
    process = await anyio.open_process(command, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/anyio/_core/_subprocesses.py", line 127, in open_process
    return await get_asynclib().open_process(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 1105, in open_process
    process = await asyncio.create_subprocess_exec(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/subprocess.py", line 218, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_events.py", line 1652, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/unix_events.py", line 207, in _make_subprocess_transport
    transp = _UnixSubprocessTransport(self, protocol, args, shell,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/asyncio/unix_events.py", line 799, in _start
    self._proc = subprocess.Popen(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 966, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1842, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'python'
am running on my local machine using python3.10
Copy code
import sys
import prefect
from prefect import flow, task, get_run_logger
#from utilities import AN_IMPORTED_MESSAGE
from prefect.deployments import Deployment

@task
def log_task(name):
    logger = get_run_logger()
    <http://logger.info|logger.info>("Hello %s!", name)
    <http://logger.info|logger.info>("Prefect Version = %s ๐Ÿš€", prefect.__version__)
    #logger.debug(AN_IMPORTED_MESSAGE)


@flow()
def log_flow(name: str):
    log_task(name)

deployment = Deployment.build_from_flow(
    flow=log_flow,
    name="log-simple",
    parameters={"name": "Marvin"},
    infra_overrides={"env": {"PREFECT_LOGGING_LEVEL": "DEBUG"}},
    #work_queue_name="test",
)

if __name__ == "__main__":
    deployment.apply()
this is the script
i have 2 python versions installed 3.7 and 3.10 but 3.10 is the default
j

Jeff Hale

09/26/2022, 1:15 PM
And then you run
python this_file.py
to create the deployment? Then you start an agent? Then you create a flow run? When do you get the error?
a

Aisha Merhebi

09/26/2022, 1:39 PM
Agent is running already yes i run this file
python3 this_file.py
deployment get created i try to run the deployment it fails and this error show in agent logs
j

Jeff Hale

09/26/2022, 2:03 PM
I suggest running the agent in a conda environment as the easiest way to ensure Python can be found.
a

Aisha Merhebi

09/26/2022, 2:09 PM
ok will try that thanks
3 Views