Repository: holoviz/panel

Issue:
Jupyter Panel Preview not working on `main`
I am on the main branch. I would like to take and contribute a few screenshots I think are missing in the documentation.

I would like one using the Panel Jupyter Preview. But it does not work for me. I'm on the `main` branch of Panel. I'm running inside my `panel_dev` python environment. And that is also where Jupyterlab is installed and started from.

![image](https://github.com/holoviz/panel/assets/42288570/b3bc3400-add6-490f-a728-123611551328)

```bash
404 : Not Found
You are requesting a page that does not exist!
```

My version of Jupyterlab is 3.6.3.


Discussion:
Cannot get it working with panel==1.0.0rc7 either

![image](https://github.com/holoviz/panel/assets/42288570/201d5b44-7068-457d-9be5-c11679d083cf)

Let me try a clean python environment
I just tried creating a python environment from scratch with panel==1.0.0rc7 and jupyterlab and the Jupyter Panel Preview does not work for me. Its just blank.

![image](https://github.com/holoviz/panel/assets/42288570/7ded0686-7e26-4cbe-85dc-e4cea63deaaf)

I just tried it on my Jupyterhub. And its not working there either.

The JupyterHub `base` environment is running

panel==0.14.4 bokeh==2.4.3

My panel_dev environment is running

panel==1.0.0rc7, bokeh==3.1.1

![image](https://github.com/holoviz/panel/assets/42288570/fe84ffbc-a9b9-4680-bf5d-a9c983ee6927)

```bash
Uncaught Error: Cannot find module '@bokehjs/models/layouts/alignments'
```
 
I have tried hard refreshing my browser
I've tested it extensively in all the setups you've described and have seen zero issues. Can you write up step by step instructions on these setups?
For example here's my initial test:

```
conda create -n jlab_test
pip install jupyterlab panel==1.0.0rc7 jupyterlab
```

<img width="1727" alt="Screen Shot 2023-05-11 at 11 42 45" src="https://github.com/holoviz/panel/assets/1550771/acb19dd3-4ac7-44ee-88f4-b1d3ca2283a0">

Also just tested a conda env:

```
conda create -n jlab_test_conda -c pyviz/label/dev -c conda-forge jupyterlab panel==1.0.0rc7
```

No issues on my end.
And we have this running on our JupyterHub without issue too.
>The JupyterHub base environment is running panel==0.14.4 bokeh==2.4.3

This is a problem, right now the base env determines where the Bokeh resources are served from. I might be able to fix this though. That will only fix future incompatibilities, panel==0.14.4 will continue to serve the old resources.
Can you also provide console logs in the cases where it just shows a blank page?
I've had a few people independently confirm that this works for them, this is currently the only release blocker so please report back asap.
Hi @philippjfr 

I dont know when I will get the time to investigate. I've already spent hours on trying to figure out What goes wrong or find workarounds without luck.
I just tried again with a totally fresh environment @philippjfr 

- Windows 10
- python 3.9.7

```bash
python -m venv .venv
source .venv/Scripts/activate
python -m pip install pip -U
python -m pip install panel==1.0.0rc7 jupyterlab
pip freeze
jupyter lab
```

[requirements.txt](https://github.com/holoviz/panel/files/11458678/requirements.txt)

Notebook

```python
import panel as pn

pn.extension()

pn.panel(f"Hello Panel {pn.__version__} world").servable()
```

![image](https://github.com/holoviz/panel/assets/42288570/b7bdb588-edb6-444b-bf9e-8851a91dd72f)

![image](https://github.com/holoviz/panel/assets/42288570/cf3505e2-873a-4ac2-9586-70640873c376)

Terminal Logs

[logs.txt](https://github.com/holoviz/panel/files/11458684/logs.txt)

In the logs I notice

```bash
...
A `_jupyter_server_extension_points` function was not found in nbclassic. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name 
will be deprecated in future releases of Jupyter Server.
...
Please note that updating to Notebook 7 might break some of your extensions.
...
wrote error: 'No such file or directory: WorkingInNotebook.ipynb'
```

If this has an effect, I don't know.

If I try to open the iframe link http://localhost:8888/panel-preview/render/Untitled.ipynb directly the page never loads.

Just spins forever

![image](https://github.com/holoviz/panel/assets/42288570/89e79cd3-fbee-4d94-885d-10dea750fcdc)

If I run `which jupyter` it points to the right `.venv` folder.
I also tried your conda command @philippjfr `conda create -n jlab_test_conda -c pyviz/label/dev -c conda-forge jupyterlab panel==1.0.0rc7`. It does not work either

![image](https://github.com/holoviz/panel/assets/42288570/253f1548-909c-4d7a-8cfc-7b416c1b1fb9)

This is the log from the installation

[log_conda.txt](https://github.com/holoviz/panel/files/11458805/log_conda.txt)

This is the output of `conda list --export`.

[conda_requirements.txt](https://github.com/holoviz/panel/files/11458815/conda_requirements.txt)


Continuing on the conda environment above. I `conda install ipykernel nb_conda_kernels`.

The the logs start to show more info

```bash
(jlab_test_conda) C:\repos\private\tmp>jupyter lab
[I 2023-05-12 06:24:21.475 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-05-12 06:24:21.499 ServerApp] Package jupyter_server_terminals took 0.0241s to import
[I 2023-05-12 06:24:21.499 ServerApp] Package nbclassic took 0.0000s to import
[W 2023-05-12 06:24:21.499 ServerApp] A `_jupyter_server_extension_points` function was not found in nbclassic. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-05-12 06:24:21.507 ServerApp] Package notebook_shim took 0.0000s to import
[W 2023-05-12 06:24:21.507 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-05-12 06:24:23.522 ServerApp] Package panel.io.jupyter_server_extension took 2.0132s to import
[W 2023-05-12 06:24:23.530 TerminalsExtensionApp] Config option `kernel_spec_manager_class` not recognized by `TerminalsExtensionApp`.  Did you mean `terminal_manager_class`?
[W 2023-05-12 06:24:23.530 TerminalsExtensionApp] Config option `kernel_spec_manager_class` not recognized by `TerminalsExtensionApp`.  Did you mean `terminal_manager_class`?
[W 2023-05-12 06:24:23.538 TerminalsExtensionApp] Config option `kernel_spec_manager_class` not recognized by `TerminalsExtensionApp`.  Did you mean `terminal_manager_class`?
[I 2023-05-12 06:24:23.538 ServerApp] jupyter_server_terminals | extension was successfully linked.
[W 2023-05-12 06:24:23.558 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
[W 2023-05-12 06:24:23.563 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
[W 2023-05-12 06:24:23.565 LabApp] Config option `kernel_spec_manager_class` not recognized by `LabApp`.
[I 2023-05-12 06:24:23.565 ServerApp] jupyterlab | extension was successfully linked.
[W 2023-05-12 06:24:23.573 NotebookApp] Config option `kernel_spec_manager_class` not recognized by `NotebookApp`.
[W 2023-05-12 06:24:23.581 NotebookApp] Config option `kernel_spec_manager_class` not recognized by `NotebookApp`.
[W 2023-05-12 06:24:23.589 NotebookApp] Config option `kernel_spec_manager_class` not recognized by `NotebookApp`.
[I 2023-05-12 06:24:23.589 ServerApp] nbclassic | extension was successfully linked.
[I 2023-05-12 06:24:24.189 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-05-12 06:24:24.189 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
[I 2023-05-12 06:24:26.526 ServerApp] [nb_conda_kernels] enabled, 2 kernels found
[I 2023-05-12 06:24:26.942 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-05-12 06:24:26.942 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-05-12 06:24:26.950 LabApp] JupyterLab extension loaded from C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyterlab
[I 2023-05-12 06:24:26.950 LabApp] JupyterLab application directory is C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\share\jupyter\lab
[I 2023-05-12 06:24:26.958 ServerApp] jupyterlab | extension was successfully loaded.

  _   _          _      _
 | | | |_ __  __| |__ _| |_ ___
 | |_| | '_ \/ _` / _` |  _/ -_)
  \___/| .__/\__,_\__,_|\__\___|
       |_|

Read the migration plan to Notebook 7 to learn about the new features and the actions to take if you are using extensions.

https://jupyter-notebook.readthedocs.io/en/latest/migrate_to_notebook7.html

Please note that updating to Notebook 7 might break some of your extensions.

[I 2023-05-12 06:24:26.979 ServerApp] nbclassic | extension was successfully loaded.
[I 2023-05-12 06:24:26.980 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
[I 2023-05-12 06:24:26.983 ServerApp] Serving notebooks from local directory: C:\repos\private\tmp
[I 2023-05-12 06:24:26.983 ServerApp] Jupyter Server 2.5.0 is running at:
[I 2023-05-12 06:24:26.983 ServerApp] http://localhost:8888/lab?token=a8bd6a84e5c54ebaef9fb5945f741f0abb3cb77b5e3f9861
[I 2023-05-12 06:24:26.983 ServerApp]     http://127.0.0.1:8888/lab?token=a8bd6a84e5c54ebaef9fb5945f741f0abb3cb77b5e3f9861
[I 2023-05-12 06:24:26.991 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-05-12 06:24:27.183 ServerApp]

    To access the server, open this file in a browser:
        file:///C:/Users/MASMA/AppData/Roaming/jupyter/runtime/jpserver-6868-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/lab?token=a8bd6a84e5c54ebaef9fb5945f741f0abb3cb77b5e3f9861
        http://127.0.0.1:8888/lab?token=a8bd6a84e5c54ebaef9fb5945f741f0abb3cb77b5e3f9861
[I 2023-05-12 06:24:33.132 LabApp] Build is up to date
[W 2023-05-12 06:24:38.544 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865478543 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:38.545 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:38.550 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865478543 (0b3e57f8b9964da690b213b038d2a44d@::1) 5.73ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
[W 2023-05-12 06:24:39.541 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=b497defc-d1bc-4d82-aff1-2bcf3eab2cd5 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:39.563 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=b497defc-d1bc-4d82-aff1-2bcf3eab2cd5 (0b3e57f8b9964da690b213b038d2a44d@::1) 23.21ms referer=None
[W 2023-05-12 06:24:39.566 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865479564 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:39.567 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:39.568 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865479564 (0b3e57f8b9964da690b213b038d2a44d@::1) 2.00ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
[W 2023-05-12 06:24:42.537 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=b497defc-d1bc-4d82-aff1-2bcf3eab2cd5 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:42.537 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=b497defc-d1bc-4d82-aff1-2bcf3eab2cd5 (0b3e57f8b9964da690b213b038d2a44d@::1) 0.00ms referer=None
[W 2023-05-12 06:24:42.544 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865482542 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:42.545 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:42.547 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865482542 (0b3e57f8b9964da690b213b038d2a44d@::1) 3.99ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
[W 2023-05-12 06:24:45.536 ServerApp] 404 GET /api/kernels/7e87257d-252a-4a15-b87e-5e7505cb31cc?1683865485537 (::1): Kernel does not exist: 7e87257d-252a-4a15-b87e-5e7505cb31cc
[W 2023-05-12 06:24:45.536 ServerApp] wrote error: 'Kernel does not exist: 7e87257d-252a-4a15-b87e-5e7505cb31cc'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7e87257d-252a-4a15-b87e-5e7505cb31cc)
[W 2023-05-12 06:24:45.544 ServerApp] 404 GET /api/kernels/7e87257d-252a-4a15-b87e-5e7505cb31cc?1683865485537 (0b3e57f8b9964da690b213b038d2a44d@::1) 7.96ms referer=http://localhost:8888/lab/workspaces/auto-q
[W 2023-05-12 06:24:47.536 ServerApp] 404 GET /api/kernels/7e87257d-252a-4a15-b87e-5e7505cb31cc?1683865487537 (::1): Kernel does not exist: 7e87257d-252a-4a15-b87e-5e7505cb31cc
[W 2023-05-12 06:24:47.536 ServerApp] wrote error: 'Kernel does not exist: 7e87257d-252a-4a15-b87e-5e7505cb31cc'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: 7e87257d-252a-4a15-b87e-5e7505cb31cc)
[W 2023-05-12 06:24:47.536 ServerApp] 404 GET /api/kernels/7e87257d-252a-4a15-b87e-5e7505cb31cc?1683865487537 (0b3e57f8b9964da690b213b038d2a44d@::1) 0.00ms referer=http://localhost:8888/lab/workspaces/auto-q
[W 2023-05-12 06:24:48.534 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865488532 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:48.534 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:48.534 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865488532 (0b3e57f8b9964da690b213b038d2a44d@::1) 0.00ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
[W 2023-05-12 06:24:48.544 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=b497defc-d1bc-4d82-aff1-2bcf3eab2cd5 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:48.544 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=b497defc-d1bc-4d82-aff1-2bcf3eab2cd5 (0b3e57f8b9964da690b213b038d2a44d@::1) 0.00ms referer=None
[W 2023-05-12 06:24:48.551 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865488548 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:48.551 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:48.553 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865488548 (0b3e57f8b9964da690b213b038d2a44d@::1) 2.00ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
[W 2023-05-12 06:24:49.532 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=1abddced-3ee0-41de-bf20-b0857f5c0af4 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:49.532 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=1abddced-3ee0-41de-bf20-b0857f5c0af4 (0b3e57f8b9964da690b213b038d2a44d@::1) 0.00ms referer=None
[W 2023-05-12 06:24:49.539 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865489537 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:49.543 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:49.545 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865489537 (0b3e57f8b9964da690b213b038d2a44d@::1) 6.00ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
[W 2023-05-12 06:24:51.534 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=1abddced-3ee0-41de-bf20-b0857f5c0af4 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:51.534 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=1abddced-3ee0-41de-bf20-b0857f5c0af4 (0b3e57f8b9964da690b213b038d2a44d@::1) 0.00ms referer=None
[W 2023-05-12 06:24:51.543 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865491541 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:51.544 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:51.545 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865491541 (0b3e57f8b9964da690b213b038d2a44d@::1) 2.04ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
[W 2023-05-12 06:24:54.532 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=1abddced-3ee0-41de-bf20-b0857f5c0af4 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:54.532 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e/channels?session_id=1abddced-3ee0-41de-bf20-b0857f5c0af4 (0b3e57f8b9964da690b213b038d2a44d@::1) 0.00ms referer=None
[W 2023-05-12 06:24:54.544 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865494538 (::1): Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e
[W 2023-05-12 06:24:54.544 ServerApp] wrote error: 'Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e'
    Traceback (most recent call last):
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\tornado\web.py", line 1769, in _execute
        result = await result
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\handlers.py", line 72, in get
        model = await ensure_async(km.kernel_model(kernel_id))
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 496, in kernel_model
        self._check_kernel_id(kernel_id)
      File "C:\Users\MASMA\Anaconda3\envs\jlab_test_conda\lib\site-packages\jupyter_server\services\kernels\kernelmanager.py", line 527, in _check_kernel_id
        raise web.HTTPError(404, "Kernel does not exist: %s" % kernel_id)
    tornado.web.HTTPError: HTTP 404: Not Found (Kernel does not exist: e1730861-77c1-4781-b198-12df8fdfe43e)
[W 2023-05-12 06:24:54.545 ServerApp] 404 GET /api/kernels/e1730861-77c1-4781-b198-12df8fdfe43e?1683865494538 (0b3e57f8b9964da690b213b038d2a44d@::1) 1.98ms referer=http://localhost:8888/lab/workspaces/auto-r/tree/Untitled.ipynb
```

I don't know if the kernel that is not found is reported by the Jupyter Panel Preview?
I tried to understand the Panel Jupyter Preview code and add some logging. But its hard for me because its a lot of new code and concepts. If there was better logging in that code and I knew how to get Jupyterlab to output those logs, then I believe it could be very helpful.


Thanks @MarcSkovMadsen, so based on those logs the extension at least seems to get installed and loaded correctly:

```
[I 2023-05-12 06:24:23.522 ServerApp] Package panel.io.jupyter_server_extension took 2.0132s to import
...
[I 2023-05-12 06:24:24.189 ServerApp] panel.io.jupyter_server_extension | extension was successfully linked.
...
[I 2023-05-12 06:24:26.980 ServerApp] panel.io.jupyter_server_extension | extension was successfully loaded.
```

There definitely do seem to be some weird configuration issues happening on your side but I can't yet eliminate that the extension is doing something wrong either. Will have some more folks do testing on Windows.
Again more logs would be helpful.

Jupyter is also a bit complicated because even though I install it from scratch in a virtual environment it is interacting with other virtual environments as it tries to read them. And there is also some complexity I don't understand in that notebook kernels and conda kernels do not seem to be the same thing.

The issues I can imagine are 1. Somehow my `base` Anaconda environment is corrupted or 2. something like windows path is not properly supported by the Jupyter Panel Preview or 3. The Jupyter Panel Preview tries to save something to a location that is readonly.

Resolving patch:
diff --git a/panel/io/jupyter_server_extension.py b/panel/io/jupyter_server_extension.py
--- a/panel/io/jupyter_server_extension.py
+++ b/panel/io/jupyter_server_extension.py
@@ -111,7 +111,7 @@ def get_server_root_dir(settings):
 import pathlib
 import sys
 
-app = '{{ path }}'
+app = r'{{ path }}'
 os.chdir(str(pathlib.Path(app).parent))
 sys.path = [os.getcwd()] + sys.path[1:]
 
@@ -186,6 +186,8 @@ async def _get_info(self, msg_id, timeout=KERNEL_TIMEOUT):
                 comm_id = msg['content']['comm_id']
             elif msg_type == 'stream' and msg['content']['name'] == 'stderr':
                 logger.error(msg['content']['text'])
+            elif msg_type == "error":
+                logger.error(msg['content']['traceback'])
         return result, comm_id, extension_dirs
 
     @tornado.web.authenticated


Test patch: