Is Bokeh compatible with Google App Engine?

房东的猫 提交于 2020-01-24 21:50:54

问题


I've been working through this Udacity web dev course and wanted to try embedding a simple bokeh plot into a web page using this example. Running dev_appserver.py gives the error:

ERROR    2017-01-22 14:35:30,358 wsgi.py:263]
Traceback (most recent call last):
  File "C:\Users\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform
\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
    handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
  File "C:\Users\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform
\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
    handler, path, err = LoadObject(self._handler)
  File "C:\Users\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform
\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
    obj = __import__(path[0])
  File "C:\Users\Google Drive\Udacity web development 2017\udacit
y-cs253\bokeh\1_docs_example\main.py", line 2, in <module>
    from bokeh.plotting import figure
  File "C:\Users\Google Drive\Udacity web development 2017\udacit
y-cs253\bokeh\1_docs_example\lib\bokeh\plotting\__init__.py", line 2, in <module
>
    from ..document import Document; Document
  File "C:\Users\Google Drive\Udacity web development 2017\udacit
y-cs253\bokeh\1_docs_example\lib\bokeh\document.py", line 45, in <module>
    from .core.json_encoder import serialize_json
  File "C:\Users\Google Drive\Udacity web development 2017\udacit
y-cs253\bokeh\1_docs_example\lib\bokeh\core\json_encoder.py", line 53, in <modul
e>
    NP_MS_DELTA = np.timedelta64(1, 'ms')
TypeError: function takes at most 1 argument (2 given)
INFO     2017-01-22 14:35:30,571 module.py:806] default: "GET / HTTP/1.1" 500 -

I may be wrong but the above error combined with this suggests Bokeh requires NumPy>1.6.1. Specifically it's json_encoder.py that seems to require NumPy>1.6.1.

However Google App Engine only supports NumPy1.6.1. Does this mean Bokeh is effectively not compatible with GAE?

app.yaml:

runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: main.app

libraries:
- name: jinja2
  version: latest
- name: numpy
  version: "1.6.1"

回答1:


Does this mean Bokeh is effectively not compatible with GAE?

I would say this is a fairly accurate assessment for recent versions, e.g Bokeh 0.12.4. It also appears that the NumPy 1.7.1 requirement goes all the way back to the beginning of the project. However, there was a time when Bokeh depended less on NumPy, so it's possible you might have better luck with older versions of Bokeh and either 1) no NumPy installed, or 2) the older GAE NumPy installed. I can't state this for certain, you'd just have to try and see (YMMV).

I can state that AFAIK no-one on the Bokeh core team has used GAE, so it's not surprising that no-one knew anything about the NumPy limitation there. It's perhaps possible that the NumPy version could be loosened to include 1.6.1. I don't know for sure, it would take some investigation, and there are no guarantees that it would be feasible. We can certainly try to consider it, as time and resources permit, so I'd encourage you to make an issue on the Bokeh project issue tracker. Another reasonable action would be to petition GAE to update their whitelist, as NumPy 1.6.1 is fairly ancient at this point.




回答2:


I was trying to use bokeh server on Google App Engine Flex, which does not have the numpy version restrictions referenced in the original question. However, even with an updated numpy I still could not get it to work. Eventually I found this 10 year old open issue on Google's issue tracker. It looks like Google App Engine is missing web socket support for both the Standard and Flexible environments. Since bokeh server communicates using websockets, this may be another reason you were seeing a failure.

There is a comment dated Jul 23, 2018 from a googler that reads:

Hi everyone, we are making steady progress on the Flex Websockets Beta launch and will be making it available soon.

Websockets for Standard are at least a year away. I'll continue to update here as we get more clarity on the timeline.

So there might be hope for bokeh applications on App Engine pretty soon.



来源:https://stackoverflow.com/questions/41792504/is-bokeh-compatible-with-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!