google-app-enginegoogle-cloud-automl

How to solve ModuleNotFoundError: No module named 'google.cloud' while importing automl in GAE Standard?


I get a-

ModuleNotFoundError: No module named 'google.cloud' 

My environment details are standard environment, python 3.8, F1

I am using automl and everything works fine in my local machine with google-cloud-automl conda package which I include in the requirements file. What is going wrong? I vaguely have a guess that it may be due to a difference between second generation vs first generation of GAE instances. Any help would be appreciated. Thank you.

Note: Similar previous questions/answers involve one of (a) package issue at a local server (b) importing deprecated google-cloud package


Solution

  • According to this answer, if you are using a conda to install your packages:

    There is no way to install packages on App Engine Standard with an installer other than pip.

    You should use pip to install your packages in App Engine Standard to avoid unexpected errors. I did replicate importing automl in App Engine Standard and there's no problem at all. If you want to still use conda You can consider App Engine Flex that supports Custom Runtime which allows you to define your preferred environments.