I am doing a very simple example, but keep getting...
# ask-community
d
I am doing a very simple example, but keep getting the message
AttributeError: 'Flow' object has no attribute 'serve'
.
a
Hey @David Maier! What version of
prefect
do you have installed? Sharing the output of
prefect version
would be great!
d
Copy code
Version:             2.82
API version:         0.8.4
Python version:      3.9.14
Git commit:          afbed19d
Built:               Fri, Feb 17, 2023 10:02 AM
OS/Arch:             darwin/arm64
Profile:             default
Server type:         cloud
Whereby the Prefect version in my deps file is
prefect = "^2.13"
Copy code
python = ">=3.9,<3.11"
requests = "^2.27.1"
prefect = "^2.13"
prefect-dask = "^0.2.5"
redis = "^4.1.1"
cleo = "^0.8.1"
boto = "^2.49.0"
boto3 = "^1.22.4"
scipy = "^1.8.1"
plotly-express = "0.4.0"
kaleido = "0.2.1"
markdown = "3.3.7"
sendgrid = "6.9.7"
pydantic = "<2.0.0"
a
Thanks! Are you using
poetry
? I remember seeing another user that used
poetry
that had a similar issue and a similar
prefect version
output.
d
Yes, but it shouldn’t make any difference, right? It just installs the deps to a virtualenv.
a
The most recent version of
prefect
is
2.13.5
, but
poetry
installed a version that is nearly eight months old, which is why
.serve
isn’t working for you.
d
BTW: Maybe unrelated. I realized that I had to pin the
pydantic
version because the CLI would otherwise not work as expected. It seems that at least one of my other dependencies does refer to a newer version because I didn’t have
pydantic
listed as an explicit dependency before.
OK, so let me try with 2.13.5 then
a
Ah, if you pinned
pydantic
then that might cause this behavior. Can you share the error that you saw from the CLI?
d
ImportError: cannot import name 'SecretField' from 'pydantic'
I am updating to
2.13.5
now and also removed the hardcoded
pydantic
version from my Poetry environment … so fingers crossed.
a
Just for reference, what version of
poetry
are you using?
d
OK, it seems to work now. I am right now upgrading an older Prefect 1.x project to 2.x and had to do a bunch of things to get it working:
1. I am now using version 2.13.5 of Prefect
2. The Poetry version was also outdated. I was on 1.1 which caused that
poetry update
ended up in an endless loop 🤷, so I am now using Poetry 1.6.1.
1
The
serve
function works now as expected. Thanks!
💪 1
🎉 1