Questions on server deployment of Panel app

Hello there

I have some questions on server deployment of a Panel app.

I am writing about my repo at https://github.com/mycarta/faults where I have a number of Jupyter notebooks.

In particular, the notebook Demonstrate_colormap_distortions_interactive_Panel.ipynb is my first Panel app. It is a small app to demonstrate perceptual effect of colormaps on some geophysical data.

I developed the notebook while following loosely the Panel Getting Started tutorial; I have on my machine (a mac running OS Mojave - 10.14.6) a virtual environment created according to the Holoviz Setup instructions.

When I run gspec.show() a the end of the notebook the app worked fine:

Next I commented gspec.show() and uncommented gspec.servable() and then on the command line (with the same environment) I executed:
panel serve Demonstrate_colormap_distortions_interactive_Panel.ipynb

What I see on the terminal is:

Starting Bokeh server version 2.0.2 (running on Tornado 6.0.4)
User authentication hooks NOT provided (default user enabled)
Bokeh app running at: http://localhost:5006/Demonstrate_colormap_distortions_interactive_Panel
Starting Bokeh server with process id: 49256

But nothing happens!

Has anyone seen this behaviour? Is there anything else in terms of system settings of requirements/dependencies I should be looking at?

After that I tried deployment using Binder.
I created this environment file:
name: faults
channels:
- conda-forge
- pyviz
- defaults
dependencies:
- numpy=1.18.1
- panel=0.9.5
- param=1.9.3
- python=3.7.7
- scipy=1.4.1
- scikit-image=0.16.2

I am reasonably sure I followed the correct procedure for Binder because when I click on the Binder button in the repo README, the (non interactive) notebooks in the repo work just fine on the Binder server.

However, when I use this link for the app:
https://mybinder.org/v2/gh/mycarta/faults/master?urlpath=/proxy/5006/Demonstrate_colormap_distortions_interactive_Panel.ipynb

I get this error:
404: Not Found
You are requesting a page that does not exist.

Any advice on how to proceed would be appreciated.
Thanks, Matteo

when you use panel serve you can add the optionn --show and the app will open in the browser. Or you can go to the address http://localhost:5006/Demonstrate_colormap_distortions_interactive_Panel where the app is working.

1 Like

Have you tried following the Binder deployment guide here: https://panel.holoviz.org/user_guide/Server_Deployment.html

I think the only step you’re missing is adding jupyter_panel_proxy to your environment file.

Thanks for your suggestion @nghenzi2019
By using the --show option things move along (in the sense that a new browser tab is started with the address http://localhost:5006/Demonstrate_colormap_distortions_interactive_Panel , but then I get a whole bunch of errors:

However, after further investigation, I solved it by adding at the top of the notebook the code:
import matplotlib
matplotlib.use('WebAgg')
which fixed the FigureCanvasMac problem.

So now the panel serve --show works!

Thanks @philippjfr
Yes, I was following the official Binder deployment but must have forgotten that bit. Now comes the beginner question: what is the proper syntax?

If I just add jupyter_panel_proxy at the bottom, like this:
name: faults
channels:

  • conda-forge
  • pyviz
  • defaults
    dependencies:
  • numpy=1.18.1
  • panel=0.9.5
  • param=1.9.3
  • python=3.7.7
  • scipy=1.4.1
  • scikit-image=0.16.2
  • jupyter_panel_proxy

I get this error:

I would expect that to work. I’ll look into it.

1 Like

@philippjfr I figured out the environment part:
The package has to be added as jupyter-panel-proxy, instead of jupyter_panel_proxy as in the Binder deployment guide

From here:

  1. Would you like me to submit an issue about this for the guide?

  2. If I now use the link: https://mybinder.org/v2/gh/mycarta/faults/master?urlpath=/proxy/5006/Demonstrate_colormap_distortions_interactive_Panel.ipynb I get a
    500 : Internal Server Error
    Do you have any further recommendations, ideas? I seem to have hit a wall.

The docs are clearly incorrect in several regards. This URL works for me:

Please do file an issue, or better yet a PR.

1 Like

Well it tries to load the app, but clearly there’s some issue with it as it stays blank.

PR done: https://github.com/holoviz/panel/pull/1328

I get a blank app too…
Do you have an idea what the issue might be, or further ways to troubles?
I am now able to serve the app locally on my machine (mind you, using the virtualenv from the holoviz-tutorial) with both options .show() and .servable()
I probably have enough to turn this into a Stack Overlow question, or I could move on and try Heroku, but it’b be nice to sort if this is a panel issue or a mycarta issue

I wish Binder had some way to view the logs. I can only recommend setting up the environment from your environment.yml locally and then running panel serve to find if there are any issues.

I am happy to report that now the app works!
It was not working earlier because with my earlier commit this morning I’d forgotten to switch back from .show() back to servable()
Just to be 100% sure, would you try it?

Works for me.

1 Like

I moved the app to a new repo. THe correct link is: