简体   繁体   中英

ImportError: No module named api_core.exceptions

I wanted to run a google.cloud.storage dependency to my project so I tried to install this dependency with

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

Running the above command, we installed all the required packages in the apache airflow dist-packages directory ex:- dist-packages

When i imported libraries into my project using the below code.

from airflow.contrib.operators.mysql_to_gcs import MySqlToGoogleCloudStorageOperator

running the project on pyhton, i am getting the error ImportError: No module named api_core.exceptions

here is the trace

#python mysql_to_gcs.py
[2019-04-30 06:45:09,668] {settings.py:182} INFO - settings.configure_orm(): Using pool settings. pool_size=5, pool_recycle=1800, pid=15440
Traceback (most recent call last):
  File "mysql_to_gcs.py", line 2, in <module>
    from airflow.contrib.operators.mysql_to_gcs import MySqlToGoogleCloudStorageOperator
  File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/operators/mysql_to_gcs.py", line 25, in <module>
    from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
  File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/hooks/gcs_hook.py", line 25, in <module>
    from airflow.contrib.hooks.gcp_api_base_hook import GoogleCloudBaseHook
  File "/usr/local/lib/python2.7/dist-packages/airflow/contrib/hooks/gcp_api_base_hook.py", line 30, in <module>
    from google.api_core.exceptions import GoogleAPICallError, AlreadyExists, RetryError
ImportError: No module named api_core.exceptions


Instead of --upgrade google-api-python-client Just reinstall api-core using
pip install dialogflow

Upgrade has some weird problems which does not update api-core.

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