Is it possible to use Panel in Google Colaboratory. I can get it to work with
!pip install hvplot
!pip install panel
at the top of the notebook, and everything runs OK … but I don’t get any other output (other than stuff I can print() out).
Thanks for any help,
Chris
jbednar
February 25, 2020, 1:15pm
2
Yes, it is possible, but very awkward due to constraints imposed by colab: https://github.com/holoviz/holoviews/issues/3551
Thanks for the heads up. I didn’t know that about Colab.
Chris
korakot
September 26, 2020, 6:57am
4
Here’s what I do to use it in Colab
Add pn.extension() in any cell going to display
In some case, I need to update ipykernel !pip install ipykernel -U
, then restart runtime.
1 Like
jbednar
November 15, 2020, 3:43am
5
In Panel 0.10.2 (released 11/18/2020), you can now use pn.extension(comms='colab')
, which automatically inserts the extension code into every cell. The notebook gets a bit bloated in file size, but that way you won’t have to put pn.extension()
everywhere.
2 Likes
korakot
November 15, 2020, 4:07am
6
You may not need to insert into every cell. Only before cell that need to display.
Here’s what I did.
import panel as pn
def pn_repr(self, include=None, exclude=None):
pn.extension()
return pn.viewable.Viewable._repr_mimebundle_(self, include, exclude)
pn.layout.Panel._repr_mimebundle_ = pn_repr
It only call pn.extension() before a Panel is displayed with repe_mimebundle.
3 Likes
Marc
November 16, 2020, 9:36am
7
I also recently find out its easy to run servers in Google Colab. This is how you do for Streamlit. use panel serve
for Panel instead.
Thank you krub. You save my day!
1 Like
diehl
August 2, 2023, 12:49am
9
I tried putting pn.extension()
in the cell in my notebook that contains the web app code but I’m not seeing any output. Anyone using Panel in Colab currently?