简体   繁体   中英

No module named 'google.cloud' Dockerfile python

I have a dockerfile with an google/cloud-sdk:alpine image. When I run it I keep getting an error saying that I am missing a module despite the fact that I installed it.

While building my image I run this

RUN pip install --upgrade google-api-python-client

and inside my Docker container I run

 # pip show google-cloud

and I get the below output

Name: google-cloud
Version: 0.34.0
Summary: API Client library for Google Cloud
Home-page: https://github.com/GoogleCloudPlatform/google-cloud-python
Author: Google Cloud Platform
Author-email: googleapis-publisher@google.com
License: Apache 2.0
Location: /usr/lib/python3.6/site-packages
Requires: 
Required-by: 

then I try to run a python script and get this error

/ # python3 ./publisher.py local create test-topic-v1
Traceback (most recent call last):
  File "./publisher.py", line 318, in <module>
    create_topic(args.project_id, args.topic_name)
  File "./publisher.py", line 46, in create_topic
    from google.cloud import pubsub_v1
ModuleNotFoundError: No module named 'google.cloud'

The google-api-python-client project is different than the google-cloud project, and the https://pypi.org/project/google-cloud/ project is deprecated:

WARNING: The google-cloud Python package is deprecated. On June 18, 2018, this package will no longer install any other packages. Please install the product-specific google-cloud-* packages needed for your application.

You should install google-cloud-pubsub instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM