Hi all, I think I'm doing something simple and mistaken. I'm using Python 3.9.6 on Windows 10, and Prefect version 2.8.4, I have the simplest code in a file called dev.py from the 1st tutorial example from the site. I'm using a Python venv too
Copy code
from prefect import flow
@flow
def my_favorite_function():
print("What is your favorite number?")
return 42
print(my_favorite_function())
And when I run
python dev.py
it gives me an error
RuntimeError: Cannot create flow run. Failed to reach API at <http://127.0.0.1:4200/api/>
I tried changing the code to:
Copy code
from prefect import flow
@flow
def my_favorite_function():
print("What is your favorite number?")
return 42
if __name__ == "__main__":
print(my_favorite_function())
And it still gives me the same error.
Am I missing something? I'm sure I've run this code before when trying to learn
k
kasteph
03/09/2023, 10:14 PM
do you have the prefect server running?
j
Janet Carson
03/10/2023, 4:11 AM
Once you've created a prefect server, it seems the server must always be running, even if you are just running from the command line and not through a deployment.
y
YSF
03/14/2023, 3:58 PM
Yeah sorry it wasn't running. I was stepping through the Get Started docs. It has flow code examples without any explicit mention of prefect server until much later. Similarly it asks you to apply a deployment before starting an agent.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.