Hi, can I get an explanation for what causes this ...
# ask-community
h
Hi, can I get an explanation for what causes this versioning error? Where are the two environments mentioned here?
Copy code
Failed to load and execute Flow's environment: FlowStorageError("An error occurred while unpickling the flow:\n  TypeError('an integer is required (got type bytes)')\nThis may be due to one of the following version mismatches between the flow build and execution environments:\n  - python: (flow built with '3.7.5', currently running with '3.8.11')")
k
Hey @Hugo Kitano, one is the version your flow was built in, and the other is the Python version of the agent. These need to be the same for the most part, especially Python versions as that changes serialization. You will run into errors if you serialize Python 3.8 and deserialize 3.7 for example
h
so, by “flow built in”, do you mean the python that’s used when I call
prefect register -p path_to_flow.py
?
k
Yes exactly
👍 1
m
I have a follow up. What is actually being registered, the .py files? If so since the task image can be different then the agent / server image are there any optimizations for the compiled version of the code in the task?
k
The metadata is being registered, including the location of the flow. If you used script-based storage (S3, Github), it will be the location to the script. If you use pickle-based storage, the Flow is serialized and stored somewhere, then loaded and unpickled by Prefect. Not sure what you mean with the optimizations?
m
Sorry, I meant the compiled bytecode (
.pyc
)
k
Oh pretty sure there are no optimizations around that if that’s what you’re asking? When you say the flow image and agent image are different, if your agent running in a container?
m
So from what I understood when deploying on ECS there is a container for the agent and one for the flow (I was confused and though it’s per task, which makes sense why a pyc optimization will be useless).
k
Oh I see what you are saying. ECS task means the Prefect flow run while Prefect’s flow is comprised of Prefect tasks so there are two definitions going around. In this situation, I would say the versions for registration should ideally match both agent version and ECS flow version because having them different has caused issues where ECS version doesn’t have features that Prefect added in later versions. I don’t think the
.pyc
is used anywhere yep.
m
Thanks a lot! Fun to work with a tool that has such an active community!
👍 1