3

Went to go work on an older Python2.7 AppEngine Standard project today but I can't seem to get Endpoints to work. I downloaded the sample code to see if my project was the culprit, but the sample doesn't work either. https://cloud.google.com/endpoints/docs/frameworks/python/get-started-frameworks-python#run_local

dev_appserver.py --host 192.168.1.73 app.yaml --smtp_host=smtp.telus.net --smtp_port=25
INFO     2020-02-04 19:46:38,243 devappserver2.py:289] Skipping SDK update check.
INFO     2020-02-04 19:46:38,303 api_server.py:282] Starting API server at: http://localhost:45473
INFO     2020-02-04 19:46:38,325 dispatcher.py:267] Starting module "default" running at: http://192.168.1.73:8080
INFO     2020-02-04 19:46:38,326 admin_server.py:150] Starting admin server at: http://localhost:8000

Everything starts Okay, but when I hit the Endpoint: /_ah/api/echo/v1/echo

Traceback (most recent call last):
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 311, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/main.py", line 19, in <module>
    import endpoints
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/__init__.py", line 33, in <module>
    from .apiserving import *
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints/apiserving.py", line 71, in <module>
    from endpoints_management.control import client as control_client
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints_management/__init__.py", line 19, in <module>
    from . import auth, config, control, gen
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints_management/config/__init__.py", line 17, in <module>
    from .service_config import ServiceConfigException
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/endpoints_management/config/service_config.py", line 25, in <module>
    from apitools.base.py import encoding
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/apitools/base/py/__init__.py", line 23, in <module>
    from apitools.base.py.credentials_lib import *
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/apitools/base/py/credentials_lib.py", line 44, in <module>
    import fasteners
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/fasteners/__init__.py", line 23, in <module>
    from fasteners.lock import locked  # noqa
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/fasteners/lock.py", line 24, in <module>
    from fasteners import _utils
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/fasteners/_utils.py", line 39, in <module>
    from monotonic import monotonic as now  # noqa
  File "/home/mparkes/app_engine_projects/samples/python-docs-samples/appengine/standard/endpoints-frameworks-v2/echo/lib/monotonic.py", line 169, in <module>
    raise RuntimeError('no suitable implementation for this system: ' + repr(e))
INFO     2020-02-04 19:46:45,501 module.py:865] default: "GET /_ah/api/static/proxy.html?usegapi=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.xh-S9KbEGSE.O%2Fam%3DwQc%2Fd%3D1%2Fct%3Dzgms%2Frs%3DAGLTcCNaUSRWzhd71dAsiMVOstVE3KcJZw%2Fm%3D__features__ HTTP/1.1" 500 -
RuntimeError: no suitable implementation for this system: IOError(13, 'file not accessible')

Does this have something to do with python2.7 support being dropped on Jan 1 2020? For the record my app still runs fine on Appengine, but I wont be able to do anymore development.

[EDIT] Google Cloud Version:

Google Cloud SDK 279.0.0
alpha 2020.01.31
app-engine-python 1.9.88
app-engine-python-extras 1.9.88

[EDIT] Python:

Python 2.7.17 (default, Nov  7 2019, 10:07:09)
[GCC 7.4.0] on linux2

If I migrate to Python 3, then I lose endpoints and I'll need to completely rewrite my client code.

Thanks in advance.

mparkes
  • 331
  • 3
  • 12
  • Seems to me like the root cause is related to this: https://github.com/eventlet/eventlet/issues/401 I believe it's caused by eventlet which messes a lot with Python at the start time. As I can see from your logs, possibly monotonic.py is importing eventlet behind the scenes. You can try the workaround mentioned here: https://stackoverflow.com/questions/48925318/raise-runtimeerroryou-need-to-use-the-eventlet-server – Waelmas Feb 05 '20 at 10:26
  • Also can you please update the question providing more info mostly about your operating system, runtime environment etc. ? – Waelmas Feb 05 '20 at 10:28

1 Answers1

4

I was able to get this to work using an older version of the SDK I had.

google_appengine_1.6.63

Did the trick. I guess the newest version Google Cloud SDK 279.0.0 & app-engine-python 1.9.88 I was using has a problem with dev_appserver.py

[EDIT] Also to note the following version works too

google_appengine_1.9.87

seemes to be a problem with 1.9.88

Hope this helps anyone having the same problem.

mparkes
  • 331
  • 3
  • 12
  • 1
    How did you revert your appengine sdk to an older version ? using the `gcloud` command ? – Valentin Coudert Feb 13 '20 at 14:40
  • 1
    Seems like 274.0.1-0 was version with 1.9.87 [see here]( https://cloud.google.com/sdk/docs/release-notes#27401_2019-12-26), I've installed that version and the problem was fixed: `echo "deb http://packages.cloud.google.com/apt cloud-sdk-bionic main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list` `curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -` `apt-get update -y && apt-get install -y google-cloud-sdk` `apt-get install -y google-cloud-sdk-app-engine-python=274.0.1-0` – Peuchele Feb 19 '20 at 02:45
  • To revert to an older version you can download from the google archives https://console.cloud.google.com/storage/browser/appengine-sdks – mparkes Apr 06 '20 at 00:19