https://prefect.io logo
#prefect-community
Title
# prefect-community
m

Madison Schott

11/21/2022, 7:17 PM
Hi all, I started testing my upgrade to 2.0 and downloaded the new version. I need to deploy an update to my 1.0 version which is still in prod and now I am getting an error with my tasks. How do I revert to the Prefect 1.0 version?
1
m

Mason Menges

11/21/2022, 7:23 PM
Hey @Madison Schott I think the simplest way would probably be to just setup a separate virtual environment for prefect 1 and prefect 2, the two versions of prefect are completely separate including the Cloud offerings for both of them so it's generally best to keep the two environments as separate as possible.
m

Madison Schott

11/21/2022, 7:23 PM
Makes sense, I think the damage is already done at this point though. How would I revert back?
m

Mason Menges

11/21/2022, 7:26 PM
Do you mean in terms of your code or just the prefect package itself? if it's just the package then you should be able to unintall prefect and then install the prefect version you need for your prefect 1 flows
m

Madison Schott

11/21/2022, 7:33 PM
yeah the package itself
what is the correct version of prefect 1.0? Or the last version of 1.0 that existed before 2.0?
The issue is that I don't know what that version number would be
m

Mason Menges

11/21/2022, 7:34 PM
the latest version of 1.0 is version 1.4.0
m

Madison Schott

11/21/2022, 7:39 PM
Ok I did that now I am getting this error:
Copy code
Traceback (most recent call last):
  File "/Users/madisonschott/dbt_snowflake/data_pipeline_test_new_account.py", line 387, in <module>
    data_pipeline_test_new_account.register(project_name="Winc_Prod")
  File "/usr/local/lib/python3.9/site-packages/prefect/core/flow.py", line 1726, in register
    registered_flow = client.register(
  File "/usr/local/lib/python3.9/site-packages/prefect/client/client.py", line 855, in register
    serialized_flow = flow.serialize(build=build)  # type: Any
  File "/usr/local/lib/python3.9/site-packages/prefect/core/flow.py", line 1515, in serialize
    storage = self.storage.build()  # type: Optional[Storage]
  File "/usr/local/lib/python3.9/site-packages/prefect/storage/docker.py", line 325, in build
    self._build_image(push=push)
  File "/usr/local/lib/python3.9/site-packages/prefect/storage/docker.py", line 357, in _build_image
    client = self._get_client()
  File "/usr/local/lib/python3.9/site-packages/prefect/storage/docker.py", line 572, in _get_client
    return docker.APIClient(
  File "/usr/local/lib/python3.9/site-packages/docker/api/client.py", line 197, in __init__
    self._version = self._retrieve_server_version()
  File "/usr/local/lib/python3.9/site-packages/docker/api/client.py", line 221, in _retrieve_server_version
    raise DockerException(
docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))
m

Mason Menges

11/21/2022, 7:42 PM
if you run this command in the CLI does it show your cloud 1 tenants?
Copy code
prefect auth list-tenants
m

Madison Schott

11/21/2022, 7:43 PM
yup
I think I got it- thanks!
m

Mason Menges

11/21/2022, 7:48 PM
Brilliant, what ended up being the issue if you don't mind my asking?
m

Madison Schott

11/21/2022, 7:55 PM
Actually, false alarm...
Copy code
Step 13/13 : RUN python /opt/prefect/healthcheck.py '["/opt/prefect/flows/data-pipeline-test-new-account.prefect"]' '(3, 9)'
 ---> Running in 1fe1ff1c4327
/opt/prefect/healthcheck.py:125: UserWarning: Your Docker container is using python version (3, 7), but your Flow was serialized using (3, 9); this could lead to unexpected errors in deployment.
  system_check(python_version)

Beginning health checks...
Traceback (most recent call last):
  File "/opt/prefect/healthcheck.py", line 130, in <module>
    flows = cloudpickle_deserialization_check(flow_file_paths)
  File "/opt/prefect/healthcheck.py", line 43, in cloudpickle_deserialization_check
    flows.append(cloudpickle.loads(flow_bytes))
AttributeError: Can't get attribute '_make_function' on <module 'cloudpickle.cloudpickle' from '/usr/local/lib/python3.7/site-packages/cloudpickle/cloudpickle.py'>
I don't remember every changing the Python version, but maybe that happened when I downloaded 2.0?
m

Mason Menges

11/21/2022, 7:57 PM
Maybe but that would be odd since this should be based on the python version you have pointed for the image in your Dockerfile
m

Madison Schott

11/21/2022, 8:01 PM
Is it because of this
FROM prefecthq/prefect:latest
in my base image?
m

Mason Menges

11/21/2022, 8:03 PM
That'd do it, you'll need to use the base image that corresponds to your python and perfect version for the flow
m

Madison Schott

11/21/2022, 8:03 PM
Can you send me the link to where to find these again?
m

Madison Schott

11/21/2022, 8:08 PM
That did the job, thanks!
m

Mason Menges

11/21/2022, 8:08 PM
No problem 😄
m

Madison Schott

11/21/2022, 10:21 PM
Now I'm running the new flow and getting this error when running
dbt deps
Everything runs fine locally so I'm not sure why this is happening
everything works fine locally so it must have something to do with the Prefect image I am using
3 Views