Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

I would like to know if there is a way to refresh the jupyter dash server without restarting the kernel #99

Open
mumususu opened this issue Aug 15, 2022 · 2 comments

Comments

@mumususu
Copy link

I am using jupyter dash to make a dash project on a jupyter notebook. Every time I update my code, I have to kill the kernel and then restart the jupyter notebook to get the changed code to work properly. Otherwise, the dash page will show a double loading error. I would like to know if there is a way to refresh the jupyter dash server without restarting the kernel.

@jon-abbott
Copy link

Here is an unofficial workaround that seems to work for refreshing callback cells without restarting the kernel:

  1. Close any running Jupyter Notebook or JupyterLab instances
  2. Make a backup of the file ~/anaconda3/lib/python3.9/site-packages/jupyter_dash/jupyter_app.py (note: the path may differ depending on your system type and installation location of jupyter-dash)
  3. Open the original jupyter_app.py in a text editor
  4. Change the line:
    kwargs['dev_tools_hot_reload'] = mode == "external" to be
    kwargs['dev_tools_hot_reload'] = True and then save and close the file
  5. Reopen Jupyter Notebook or JupyterLab as usual

This uses the hot reload capability of Dash to allow you to edit and run Jupyter cells and then see the changes for any newly-drawn callbacks. Any HTML that is already rendered won't change, however. Perhaps the dash or jupyter-dash authors know of a way to safely refresh all rendered objects?

Also, note that jupyter_app.py mentions that enabling the code change above can sometimes cause Jupyter problems when there is no active kernel. I haven't encountered this issue yet.

@benedikt-budig
Copy link

this might also be solved by #105

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants