altair-viz/altair_data_server

Blank chart displayed when `data_server` enabled in docker

xujiboy opened this issue · 7 comments

Hi,
I'm having trouble to properly display charts on jupyter notebook when it is served from a docker container. The chart can display correctly with "json" data_transformer enabled, but not with "data_server" data_transformer enabled. Below is a screenshot:
Screen Shot 2019-11-13 at 9 37 58 PM

  • the adblocker is disabled on my Chrome
  • the javascript console shows
    Screen Shot 2019-11-13 at 9 40 37 PM
  • my Dockerfile looks like this
FROM python:3.7.4-slim

WORKDIR /app

COPY ./requirement.txt /app/

RUN pip --no-cache-dir install -r requirement.txt

EXPOSE 8888

VOLUME /app

Does this mean the "data_server" connection is somehow blocked in the container? How to correct this situation?

You may have to use data_server_proxied instead, since a container essentially acts as a remote system hosted on your machine. See https://github.com/altair-viz/altair_data_server/#remote-systems for more information.

Hi @jakevdp thank you very much for the suggestion. I have pip installed jupyter-server-proxy and rebuilt the container, but still can not see the chart:
Screen Shot 2019-11-14 at 10 19 19 AM
It seems that the browser is trying to fetch the served json file ("http://localhost:8889/notebooks/proxy/16786/024361a3-42d5-43f8-a3dd-e06513fb3dcf.json") that can not be found. Is there some special configuration that needs to be done in the Dockerfile?

If that filepath cannot be resolved, I suspect that the jupyter-server-proxy is not installed on your frontend. Indeed, it's not listed in the "Loading extension" console lines in your screenshot.

I am a bit confused ... the jupyter-server-proxy is clearly installed as it shows up in the pip freeze output. Is there another way to make sure that jupyter-server-proxy is installed at the frontend (jupyter notebook)?

Yeah, Jupyter frontend extensions are super confusing. You need to make certain it's installed in the Python environment from which you launch Jupyter (not the one from which you're running the code in the notebook) And you also need to ensure the frontend extension is enabled - see https://github.com/jupyterhub/jupyter-server-proxy for more information.

Hi, I am seeing this same problem with trying to use 'alt.data_transformers.enable('data_server')'.

I am using the 'official' docker image from Jupyter folks : https://hub.docker.com/u/jupyter
Jupyter Notebook Data Science Stack build on May 4, 2020.

If I understand the above discussion, either both the altair_data_server and jupyter-server-proxy or just the jupyter-server-proxy need to be pip baked into the docker image. Correct?

If this is correct, what are correct steps recommended to do this?

I would rather not have to learn how to do this myself. So I would like to get the correct info and request it to be done by the owner of the docker images at Jupyter. Perhaps they will install Altair within the Juypter environment as well :-)

Thank you for your help and great work on Altair!
-- Dave

In Altair 5, the recommended way to work with large datasets is via Vegafusion. The documentation contains a section of how to use the Vegafusion renderer in Altair and if you need additional performance you can use the Vegafusion widget renderer instead.

We are going to archive this repo, so I'm closing all the open issues and PRs before doing so. Try out the new options for working with large data mentioned above and if you run into issues, please open an issue directly in the altair or vegafusion repo.