Running voila without Internet

I have developed an interactive python application using ipywidgets + ipympl (matplotlib) from jupyterlab and it works great during development and even tried to deploy it using Voila. All works as expected on my development machine which has internet connectivity.

My target deployment system does not have internet connectivity. And launching voila shows blank page and inspection from web developer tools I notice three cdn requests (1. MathJax , 2 & 3 to Font-awesome styles). However while running the notebook application via jupyterlab on this system without internet everything works flawlessly all font-awesome icons appear without any issues.

Am I missing any settings while running from Voila ? Why running from voila requires these external server requests ? How to make Voila work on such environment ?

Here is the link to my original post on stackoverflow

Thanks in advance for your help.

To make an offline-ready version of voila today you need to overload every reference to cdn, unpkg, etc., cache those files, and bring them along.

You may want to track (and or contribute to) the on-going effort to port voila to using the prebuilt extensions (ne “federated” extensions) which are handled entirely by the package manager you’d use to get your voila package in the first place (e.g. pip, conda).

2 Likes

voila still requires some scripts from internet as of March 2023.

I tried to fix it by customizing templates but I was not able to do it for MathJax. I worked it around by replacing internet URLs with local ones with nginx and I am sharing my config as it could be useful to someone else.

  sub_filter_types text/html text/css application/javascript;
  sub_filter 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-MML-AM_CHTML-full,Safe' '/vendor/mathjax-2.7.7-TeX-MML-AM_CHTML-full.Safe.js';
  sub_filter 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS_CHTML-full,Safe' '/vendor/mathjax-2.7.7-TeX-AMS_CHTML-full,Safe.js';
  sub_filter '[MathJax]/extensions/MathMenu.js' '/vendor/MathMenu-2.7.7.js';
  sub_filter '[MathJax]/extensions/MathZoom.js' '/vendor/MathZoom-2.7.7.js';
  sub_filter 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@^5/css/all.min.css' '/vendor/fontawesome.min.css';
  sub_filter 'https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@^5/css/v4-shims.min.css' '/vendor/fontawesome-v4-shims.min.css';
  sub_filter_once on;
1 Like

Is this using the latest 0.5.0a3 pre-release?

Voila should indeed be able to work offline without making external requests. This could be tracked in Offline voila + font-awesome stylesheet ¡ Issue #539 ¡ voila-dashboards/voila ¡ GitHub.

1 Like