2

I am trying to get region name from 2 letters state code for US. I am seeing mentioned import error on google app engine for code below.

import us

I am using python2.7 google app engine gcloud setup. Below is the command I used for deployment

gcloud app deploy
Dustin Ingram
  • 15,737
  • 2
  • 40
  • 56
ZApatel
  • 75
  • 8
  • Have a look at this Answer: https://stackoverflow.com/a/10538412/609290 – DazWilkin Jun 23 '19 at 03:47
  • @DazWilkin Hi, ya I already went over it. I can see inside google cloud sdk, pkg_resources is present. But after I deploy it could not find. Libraries are managed by google app engine itself. We have no control over it. – ZApatel Jun 23 '19 at 07:25
  • You're `pip install`'ing at least `us==1.0.0` before deployment, right? – DazWilkin Jun 23 '19 at 15:42
  • Yes I had included latest us lib in GAE project – ZApatel Jun 23 '19 at 16:02
  • I'm out of ideas. Using `virtualenv`? Standard or Flexible? If I have time later today, I'll try to repro but I suspect it's something with your local config. – DazWilkin Jun 23 '19 at 16:21
  • Thanks a lot. No not using virtualenv. I am using GAE standard env. As us lib is not supported by GAE standard env. I have included this to project repo. And then deployed using gcloud command – ZApatel Jun 23 '19 at 16:42
  • It works for me *iff* I vendor both `us` and `setuptools`. https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#copying_a_third-party_library and `pip install -t lib/ us` and `pip install -t lib/ setuptools` – DazWilkin Jun 24 '19 at 00:56
  • @DazWilkin Thanks a lot. Ya if we include setuptools then it works. But not sure if its a good idea to include that in app engine project – ZApatel Jun 24 '19 at 12:08
  • If you pay for support, Consider contacting Google. Otherwise perhaps file an issue to gain some clarity: https://issuetracker.google.com/issues – DazWilkin Jun 24 '19 at 16:41
  • It's OK to vendor `setuptools` into your project, but it is one of the [built-in third-party libraries](https://cloud.google.com/appengine/docs/standard/python/tools/built-in-libraries-27), are you [specifying it in your `app.yaml` file](https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#using_a_built-in_third-party_library_bundled_with_the_runtime)? – Dustin Ingram Jun 26 '19 at 21:44
  • Nope I did not specify it in app.yaml file before. I will specify that in app.yaml file. Thx. – ZApatel Jun 28 '19 at 11:33

1 Answers1

2

Setuptools is one of the built-in third-party libraries. Per "Using a built-in third-party library bundled with the runtime", are you specifying setuptools in your app.yaml file?

libraries:
- name: setuptools
  version: "36.6.0"
Dustin Ingram
  • 15,737
  • 2
  • 40
  • 56