Skip to content Skip to sidebar Skip to footer

Importerror: Cannot Import Name 'pubsub_v1' From 'google.cloud' (unknown Location)

I am trying to import the pubsub_v1 in a cloud function. But when I tried to deploy it on GCP, the problem as in the title coming out. The requirements.txt file is in the same dire

Solution 1:

You're using a pretty old version of google-cloud-pubsub. You'll only be able to do:

from google.cloudimport pubsub_v1

with google-cloud-pubsub>=0.28.1.

Also, it might worth mentioning that you probably don't need to list all the sub-dependencies (like gapic-google-cloud-pubsub-v1) in your requirements.txt -- when you deploy your function, Google Cloud Functions will resolve all these for you just by specifying google-cloud-pubsub.

Post a Comment for "Importerror: Cannot Import Name 'pubsub_v1' From 'google.cloud' (unknown Location)"