Hi Folks, when deploying self-hosted Prefect serve...
# ask-community
r
Hi Folks, when deploying self-hosted Prefect server on GCP, I am encountering this error:
Copy code
DEFAULT 2024-09-06T23:24:20.993197Z Warning! Failed to load collection 'prefect_gcp': ImportError: cannot import name 'SecretDict' from 'prefect.types' (/usr/local/lib/python3.10/site-packages/prefect/types/__init__.py)
I am using this Docker image:
Copy code
--image=prefecthq/prefect:2-latest
Anyone else has the same error? Any insight on fixes or workarounds?
n
hmm this feels like a version mismatch to me as in, you might have a 3.x version of prefect-gcp but 2.x version of prefect are you installing an unbounded prefect-gcp via EXTRA_PIP_PACKAGES or somehow else at runtime?
c
+1 to what nate said -- you might try repulling the latest image if this image was pulled early this morning
y
I have the same problem. The base image I use is
prefecthq/prefect:2.20.6-python3.9
and I explicitly install the following requirements for Prefect:
Copy code
prefect==2.20.6
prefect-docker==0.5.5
prefect-gcp==0.5.17
I've already tried changing to
prefect-gcp==0.5.8
but this returns the same error.
@Ruslan Bergenov Did you find a solution for this?
IMO this is difficult to understand from the docs alone. It's not explicitly explained what the required package is.
n
hi @Yanic Möller - glad you figured it out! i pinned a message about this in #CL09KU1K7 suggesting a a safe way to install extras, eg pip install ‘prefect[gcp]<3’ and the suggestion to use the extras is here in the docs perhaps we should update the integrations guide as well to contain this info
🙏 1
r
Thank you very much folks for your feedback. I haven’t had a chance to investigate it more yet.
👍 1
@Nate RE: _are you installing an unbounded prefect-gcp via EXTRA_PIP_PACKAGES or somehow else at runtime?_ I was installing it like this, while deploying a Cloud Run worker:
Copy code
gcloud run deploy $WORKER --image=prefecthq/prefect:2-latest \
--set-env-vars
........
--args "prefect","worker","start","--install-policy","always","--with-healthcheck","-p","cloud_run_work_pool","-t","cloud-run"
I will try the suggested workarounds.
I just deleted the 2 Cloud Run services (worker and server). Then I redeployed my worker and server on GCP as Cloud Run services from scratch and the error is gone. I am assuming the dependency error may have been fixed.
Copy code
gcloud run deploy $SERVER --image=prefecthq/prefect:2-latest
…..
Copy code
gcloud run deploy $WORKER --image=prefecthq/prefect:2-latest
….