runserver error in latest version of gcloud sdk

44 views
Skip to first unread message

Jacob G

unread,
Jan 19, 2020, 8:22:01 PM1/19/20
to djangae-users
In the latest version of gcloud sdk, I'm getting this error when using runserver:

/usr/local/Cellar/python@2/2.7.16/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/Users/jacob/workspace/f/gae/src/_python_runtime.py': [Errno 2] No such file or directory
ERROR    2020-01-19 21:11:16,431 instance.py:283] Cannot connect to the instance on localhost:15554
Traceback (most recent call last):
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/instance.py", line 279, in start
    self._runtime_proxy.start()
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/http_runtime.py", line 429, in start
    self._proxy.wait_for_connection(self._process)
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/http_proxy.py", line 96, in wait_for_connection
    http_utils.wait_for_connection(self._host, self._port, process, retries)
  File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/http_utils.py", line 63, in wait_for_connection
    host=host, port=port))
HostNotReachable: Cannot connect to the instance on localhost:15554

Is anyone else seeing this error? It seems like the issue has something to do with current working directory, that perhaps gcloud sdk changed something with its path search, because _python_runtime.py is in the gcloud sdk, not in the user application.

I've opened a ticket with gcloud support, but still waiting to hear back.

Jacob G

unread,
Jan 20, 2020, 7:25:22 AM1/20/20
to djangae-users
More info: I downgraded to from gcloud sdk version 276 to 274.0.1, and it resolves the issue. Here is the command:
```
Jacobs-MacBook-Pro:~ jacob$ gcloud components update --version 274.0.1


Your current Cloud SDK version is: 276.0.0
You will be upgraded to version: 274.0.1

┌─────────────────────────────────────────────────────────┐
│            These components will be updated.            │
├─────────────────────────────────┬────────────┬──────────┤
│               Name              │  Version   │   Size   │
├─────────────────────────────────┼────────────┼──────────┤
│ BigQuery Command Line Tool      │     2.0.51 │  < 1 MiB │
│ Cloud SDK Core Libraries        │ 2019.12.27 │ 12.7 MiB │
│ Cloud Storage Command Line Tool │       4.46 │  3.6 MiB │
│ gcloud app Python Extensions    │     1.9.87 │  6.0 MiB │
│ gcloud cli dependencies         │ 2019.12.17 │  3.3 MiB │
│ kubectl                         │    1.13.11 │ 50.8 MiB │
└─────────────────────────────────┴────────────┴──────────┘
```

That downgrade changes "gcloud app Python Extensions" (i.e., App Engine SDK) from version 1.9.88 to 1.9.87. So it looks like something changed in version 1.9.88 to break the development application server.

No word yet from Google Support. It's a P2 issue, so hopefully today I'll hear something. Anyone else seeing this?

Jacob G

unread,
Oct 21, 2020, 12:53:21 PM10/21/20
to djangae-users
Just adding update on this old post.

To be clear, I am using 1077-gcloud branch which I just noticed was never merged into the official 1.x branch. I guess it was punted in favor of direct transition to version 2.

For those using 1077-gcloud branch, i.e., gcloud sdk, on gcloud sdk version 276+ (i.e, app-engine-python 1.9.88+), there is a change to the way the gae local devserver instantiates the python runtime which breaks djangae. To make it work, you'll need to edit the runserver module. The line of code that mutates instance_factory._RUNTIME_PATH needs to change to:

instance_factory.PythonRuntimeInstanceFactory.SetPython27RuntimePath(os.path.join(sdk_path, '_python_runtime.py'))

Also the way that djangae gets the sdk version using google.appengine.tools.sdk_update_checker.GetVersionObject doesn't work anymore. It always returns 0.0.0, which breaks version compatibility checks that djangae does. I haven't yet looked for an alternative mechanism.

Reply all
Reply to author
Forward
0 new messages