I am using Prefect 2.3.1 and installed the same in anaconda environment. Getting error while trying to execute below lines.
import prefect
from prefect import task, Flow
(mlflow_env) C:\Ananda\Projects\Summbo\prefect>python hello_flow.py
Traceback (most recent call last):
File “C:\Ananda\Projects\Summbo\prefect\hello_flow.py”, line 2, in
from prefect import task, Flow
ImportError: cannot import name ‘task’ from ‘prefect’ (unknown location)
1 Like
from prefect import task, Flow
is Prefect 1 syntax.
I think you want
from prefect import task, flow
(no capitalization)
Did you do pip install -U prefect
?
1 Like
Thank you, indeed I have installed prefect 2.3.1 but using code of prefect 1.Changing code to prefect 2 now following Migration Guide - Prefect 2
I am trying to convert this import statement to prefect 2 but yet to find the way to do so.
from prefect.engine.results import LocalResult
I am newbie to Prefect, so apology if these changes are rather straightforward.
Results are not yet available in 2.0, but we are working on it – currently, all results are by default persisted to PREFECT_LOCAL_STORAGE_PATH='${PREFECT_HOME}/storage'
this will be more configurable soon
1 Like