I'm following the Prefect tutorial available at: https://docs.prefect.io/core/tutorial/01-etl-before-prefect.html. The code can be downloaded from the git: https://github.com/PrefectHQ/prefect/tree/master/examples/tutorial
The tutorials have a dependency to aircraftlib which is a directory under tutorials. I can execute the Flows through the terminal with:
python 02_etl_...
and it executes perfectly!
I've created a project, and added the Flow to that project. Through the Prefect Server UI I can run the Flow, but it fails with the error message:
State Message: Failed to load and execute Flow's environment: ModuleNotFoundError("No module named 'aircraftlib'")
How should I handle the dependency when executing the Flows through the Prefect Server UI?
This depends partially on the type of Flow Storage and Agent you are using. Since you are running with Prefect Server, I assume you are using Local Storage + a Local Agent; in this case, you need to make sure the aircraftlib
directory is on your local importable Python PATH. There are a few ways of doing this:
tutorial
directory; your Local Agent's path will then be inherited by the flows it submitstutorial/
directory to your global python path (I don't recommend this)tutorial/
directory to your Agent's path with the -p
CLI flag; for example: prefect agent start -p ~/Developer/prefect/examples/tutorial
(this is the approach I recommend)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With