PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
15.95k stars 1.57k forks source link

Report of issue with ephemeral server in Windows #15414

Closed jlowin closed 1 week ago

jlowin commented 1 week ago

Bug summary

Received the following report from @kingabzpro -- it looks like the ephemeral server failing to start with an error that looks like it isn't uncommon in windows when shell=True isn't passed? I'm not entirely sure: https://github.com/PrefectHQ/ControlFlow/issues/315

Version info (prefect version output)

3.0.2

Additional context

Copied from cross issue:

 File "C:\Repository\Hugging Face\Water-Quality-Classifier\test.py", line 17, in <module>                            
    classifications = cf.run(
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\controlflow\run.py", line 110, in run
    results = run_tasks(
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\tasks.py", line 997, in __call__
    return run_task(
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\task_engine.py", line 1491, in run_task
    return run_task_sync(**kwargs)
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\task_engine.py", line 1298, in run_task_sync    
    with engine.start(task_run_id=task_run_id, dependencies=dependencies):
  File "C:\Users\abida\anaconda3\envs\py310\lib\contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\task_engine.py", line 712, in start
    with self.initialize_run(task_run_id=task_run_id, dependencies=dependencies):
  File "C:\Users\abida\anaconda3\envs\py310\lib\contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\task_engine.py", line 636, in initialize_run    
    with SyncClientContext.get_or_create() as client_ctx:
  File "C:\Users\abida\anaconda3\envs\py310\lib\contextlib.py", line 135, in __enter__
    return next(self.gen)
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\context.py", line 231, in get_or_create
    with SyncClientContext() as ctx:
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\context.py", line 204, in __init__
    client=get_client(sync_client=True, httpx_settings=httpx_settings),
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\client\orchestration.py", line 218, in get_client
    server.start()
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\server\api\server.py", line 775, in start       
    self.server_process = self._run_uvicorn_command()
  File "C:\Users\abida\anaconda3\envs\py310\lib\site-packages\prefect\server\api\server.py", line 822, in _run_uvicorn_command
    return subprocess.Popen(
  File "C:\Users\abida\anaconda3\envs\py310\lib\subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\abida\anaconda3\envs\py310\lib\subprocess.py", line 1456, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
kingabzpro commented 1 week ago

@jlowin This is not resolved. I am still getting this issue on the windows:

  File "C:\Users\abida\anaconda3\Lib\site-packages\prefect\server\api\server.py", line 822, in _run_uvicorn_command      
    return subprocess.Popen(
           ^^^^^^^^^^^^^^^^^
  File "C:\Users\abida\anaconda3\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\abida\anaconda3\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

It can only be resolved by running the server manually and setting the environment variable.

desertaxle commented 1 week ago

@kingabzpro the fix for this issue hasn't been released yet, but it will be released tomorrow! If you'd like the fix sooner, you can install prefect from main with pip install git+https://github.com/PrefectHQ/prefect.git@main#egg=prefect.