Panel code runs on Linux (Ubuntu 20.04) but not on Windows 10

This is my code:

import panel as pn
import param

pn.extension()

allPlots = ['FOG','UP','DOWN','PCT']

class ParkLab(param.Parameterized):
    PlotsList      = param.ListSelector(default=['FOG'],objects=allPlots, precedence=0.5)
    UpdateGraphsTrigger = param.Integer(default=0)

@pn.depends(ParkLab.param.UpdateGraphsTrigger, ParkLab.param.PlotsList)
def updateGraphs(i, pl):
    print('updateGraphs:', i)
    tabs = pn.Tabs(('Beginning', pn.pane.Markdown('Test '+ str(i) + ' [%s]' % ', '.join(map(str, ParkLab.PlotsList)))),('StartTime1_s', ParkLab.param.UpdateGraphsTrigger))
    #tabs = pn.pane.Markdown('Test ' + str(i) + ' [%s]' % ', '.join(map(str, ParkLab.PlotsList)))
    return tabs

caption = pn.pane.Markdown('Portal', width=450)
pn.Column(caption, ParkLab.param, updateGraphs)

It runs on linux (Ubuntu 20.04), but does nothing on Windows 10.

This is the expected output after having clicked the up arrow on UpdateGraphsTrigger and control click on UP: (see attached picture)


After clicking on the up arrow on UpdateGraphsTrigger, the trigger itself changes from 0 to 1 on linux, but stays 0 on Windows.
After control click on UP, the PlotsList shows both FOG and UP selected on linux, but only FOG on Windows.
The text under Beginning has been changed from 'Test 0 [FOG] ’ to ‘Test 1 [FOG, UP]’ on linux but remains at its initial value on Windows.

On linux, these are the versions:
panel 0.9.7
pyviz_comms 0.7.6
python 3.8.5
ipython 7.16.1
jupyterlab 2.2.5

What can I do to make this work on Windows 10?

On Windows 10:
panel 0.9.7
pyviz_comms 0.7.6
python 3.7.7
ipython 7.17.0
jupyterlab 2.1.5

What can I do to get this to work on Windows 10?

Just to double check, you’ve installed the JupyterLab extension on both?

Good catch. That was it. Thank you very much. I do feel a bit stupid!

Question: the pn.extension() call does not generate any warning or error when the extension is not installed. Should it?

1 Like

It definitely should but I haven’t found a great solution to make that happen yet.

I have added this to my code:

import subprocess

class osSupport():
    def osCommand(cmd):
        sp = subprocess.run(cmd, capture_output=True, shell=True, encoding="utf8")
        return [sp.stdout, sp.stderr]    

    def getLabExtensions():
        return osSupport.osCommand('jupyter labextension list')
    
    def pyvizLabExtensionExists():
        [stdout, stderr] = osSupport.getLabExtensions()
        return 'pyviz/jupyterlab_pyviz' in stderr

So I can test whether the extension is there. Maybe something like this could be put into pn.extension()?

Example output of print(stderr):

   app dir: /home/pstevens/anaconda3/envs/cer/share/jupyter/lab
        @jupyterlab/github v2.0.0  enabled  OK
        @pyviz/jupyterlab_pyviz v1.0.4  enabled  OK

(in my actual output, ‘enabled OK’ is also in color)

Note: I want to improve this by having a regular expression match in the return statement but could not figure out how to do so, although my regex works when I put it in an re tester:

        p = re.compile('@pyviz\/jupyterlab_pyviz v[0-9]+\.[0-9]+\.[0-9]+ +enabled +OK')
        return p.search(stderr)

Thank you for your help.