Using Dash in an offline environment

Hello :slight_smile:

im using Domino Analytics Distribution Py3.6 R3.4 and i added those Dockerfile Instructions:

RUN pip install dash==0.22.0 && \
pip install dash-renderer==0.13.0  && \
pip install dash-html-components==0.11.0  && \
pip install dash-core-components==0.26.0  && \
pip install plotly --upgrade
RUN pip install jupyter_plotly_dash
RUN pip install "jupyterlab>=1.0" jupyterlab-dash==0.1.0a3
#RUN jupyter labextension install jupyterlab-dash
#RUN jupyter labextension install jupyterlab-dash@0.1.0-alpha.3

Source: Support Domino: Getting started with Dash

I’m in a offline env behind corporate Firewall so I need all resources available offline.

If I try to publish the example of the Guide it keeps loading for ever and the Console Shows:

If I inspect the Elemenets its clear that it trys to open scripts from sources that are unavailable:

I played around and used:

 app.css.config.serve_locally = True
 app.scripts.config.serve_locally = True

This changed the way it looked up the resources “/_dash-component-suites/dash_render/react…”

But I still get this error:

When i looked at the url “/_dash-component-suites/dash_renderer/react@15.4.2.min.js?v=0.13.0” I was unsure if I should have a folder “/_dash-component-suites/” in my tree where my “” is, but I actually thought this should be provided by the packages I installed with pip.

I then abandoned the Domino Guide and looked at plot.lys own Dash Installation - Guide

Which says:

dash automatically installs dash-renderer, dash-core-components, dash-html-components, and dash-table, using known-compatible versions of each. You need not and should not install these separately any longer, only dash itself.

So I tried switching my Dockerfile Instructions to:

pip install dash==1.4.0  # The core dash backend
pip install dash-daq==0.2.1  # DAQ components (newly open-sourced!)

But I changed dash to 1.3.1 since our local repo doesn’t have a higher Version.

Now if I publish an App there is no more “Loading…”, but also nothing shows up.

I checked the Elements:

<script src="_dash-component-suites/dash_renderer/react@16.8.6.js?v=1.1.0&amp;m=1570616379"></script>

and it Looks up the scripts local and can reach them now!

But the console has some new errors:

It doesn’t matter if i use True/False:

app.css.config.serve_locally = True
app.scripts.config.serve_locally = True

But only If i use pathname prefix the Favicon appears on the tab and the .js are reachable

 'requests_pathname_prefix': ''

I really could need some help on why my dash doesn’t render.

Thanks for every Respons and Idea! :slight_smile:

This is my current

Cross Referencing:

Using a relative requests_pathname_prefix (ie not starting with a /) is not really a use case we support. I also notice that Domino article was written with a pretty ancient version of dash (0.22.0) so I’m not surprised it has some problems with modern versions of Dash. I don’t really know much about Domino, you might want to raise this question with them.


Hello alexcjohnson!

I found a solution:

hostname = '/' + os.environ['DOMINO_PROJECT_OWNER'] + '/Dash/r/notebookSession/' + socket.gethostname()[11:] + '/'

 'assets_folder': 'assets',
 'include_asset_files': True,
 'assets_external_path': '',
 'requests_pathname_prefix': hostname

I shouldn’t have used “assets_url_path” and instead “requests_pathname_prefix” that it can find all local resources in the right place.

It works now for me, thanks for your help!

1 Like