jupyter-dash
jupyter-dash copied to clipboard
Can’t run JupyterDash or Plotly from JupyterLab (3.0.10) with docker container.
When I tried to use JupyterDash from the JupyterLab (3.0.10) docker container, I got the error that the webserver is not responding:
This page isn’t working 127.0.0.1 didn’t send any data. ERR_EMPTY_RESPONSE
My docker file:
FROM continuumio/miniconda3:latest
RUN apt update && apt upgrade -y
RUN apt install curl -y
RUN curl -fsSL https://deb.nodesource.com/setup_15.x | bash -
RUN apt-get install -y nodejs
RUN conda update conda
RUN conda install -c conda-forge jupyterlab
RUN conda install -c conda-forge -c plotly jupyter-dash
RUN jupyter lab build
RUN mkdir /opt/notebooks
WORKDIR /opt/notebooks
EXPOSE 8888 8050
CMD [ "jupyter", "lab", "--notebook-dir=/opt/notebooks", "--ip='*'", "--port=8888", "--no-browser", "--allow-root" ]
Docker build command:
docker build -t demo/dash .
Docker run command:
docker run -p 8888:8888 -p 8050:8050 -v c:\\docker\\data:/opt/notebooks demo/dash
I got the error described above, trying to run getting_started.ipynb from this repo.
Should I call JupyterDash.infer_jupyter_proxy_config() when I run notebook in container?
Another issue with this setup. If I try to use plotly, it's plots nothing, without error, just blank area after running cell. My code snippets:
import plotly.graph_objects as go
fig = go.Figure(data=go.Bar(y=[2, 3, 1]))
fig.show()
or
import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")
fig.show()
I'm also struggling to get Jupyter Dash working consistently from within a docker container setup. Note Plotly and other libraries/extensions work perfectly so i'm not sure why you are having issues there.
Is there any guide / recommended approach for using jupyter dash in a docker environment?
If it matters i'm running on a synology nas.
My dockerfile is:
FROM jupyter/minimal-notebook
COPY ./requirements.txt /requirements.txt
RUN pip install -r /requirements.txt
RUN jupyter lab build -y && jupyter lab clean -y
My requirements.txt file is:
dash
plotly
jupyter-dash
dash-bootstrap-components
dash_auth
My docker-compose file is:
version: '3'
services:
jupyter:
container_name: Jupyter
restart: always
build:
context: ./Jupyter-docker
network_mode: bridge
ports:
- "8888:8888"
- "8050:8050"
environment:
- JUPYTER_ENABLE_LAB=yes
volumes:
- /volume1/Dev/Jupyter:/home/jovyan
- /volume1/Dev/Jupyter/.config:/home/jovyan/.jupyter
I have a reverse proxy to access this via a subdomain - python.domain.com.
An example dash app is:
from jupyter_dash import JupyterDash
#import dash
import dash_auth
import dash_html_components as html
app = JupyterDash(__name__)
valid_logins = {'user': 'test1234'}
auth = dash_auth.BasicAuth(app, valid_logins)
app.layout = html.Div(['Hello World'])
app.run_server()
I'd been experimenting with different combinations to try to get it working.
If I start the dash by specifying the host - app.run_server(host='0.0.0.0') - it sometimes works and I can access the dash by going to the ip address of my nas and port 8050. However sometimes i get an error saying the port is in use, despite it not being in use.
I'd like to get it working within the jupyter environment, however i get a similar error (127.0.0.1 not found).
If anyone has any tips or suggestions it would be highly appreciated.
Same here. jupyter-dash==0.4.0 seems not to play with the latest JupyterLab 3.1.7 nicely.
I imagine a pre-build extension would help here https://github.com/plotly/jupyter-dash/issues/49