https://prefect.io logo
Title
a

Ax

01/05/2023, 10:39 PM
Hey. We’re having problems running Prefect using the tutorials provided on the website. Tried to upgrade python and install prefect latest version, but we still face this error with the basic example:
python3 test.py
Traceback (most recent call last):
  File "/Users/ax/prefect/test.py", line 9, in <module>
    flow = Flow("hello-flow", tasks=[hello_task])
  File "/Users/ax/prefect/env/lib/python3.10/site-packages/prefect/context.py", line 176, in __register_init__
    __init__(__self__, *args, **kwargs)
TypeError: Flow.__init__() got an unexpected keyword argument 'tasks'
1
b

Ben Muller

01/05/2023, 10:40 PM
the error says that you can not provide a key word argument of
tasks
like you have,
a

Ax

01/05/2023, 10:41 PM
We are using this example:
import prefect
from prefect import task, Flow

@task
def hello_task():
    logger = prefect.context.get("logger")
    <http://logger.info|logger.info>("Hello world!")

flow = Flow("hello-flow", tasks=[hello_task])

flow.run()
b

Ben Muller

01/05/2023, 10:42 PM
perhaps you are using the wrong prefect version
a

Ax

01/05/2023, 10:42 PM
prefect version
Version:             2.7.6
API version:         0.8.4
Python version:      3.10.8
Git commit:          528c8300
Built:               Wed, Jan 4, 2023 5:27 PM
OS/Arch:             darwin/x86_64
Profile:             default
Server type:         ephemeral
Server:
  Database:          sqlite
  SQLite version:    3.39.4
b

Ben Muller

01/05/2023, 10:42 PM
that is prefect version 1 and if you did
pip install prefect -U
you would have prefect v2
yes
you should use prefect v2 and search for their docs as v1 will not be supported soon
a

Ax

01/05/2023, 10:43 PM
b

Ben Muller

01/05/2023, 10:44 PM
a

Ax

01/05/2023, 10:47 PM
Perhaps we could make this more clear in the links and the docs? Some links point to cloud.prefect.io while others to prefect.cloud
k

Kalise Richmond

01/05/2023, 10:52 PM
Hi @Ax sorry for the confusion. For v2 you should use docs.prefect.io and app.prefect.cloud
a

Ax

01/05/2023, 10:56 PM
Thanks for quick help