Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning about use of ipywidgets with Panel in Colab, and to upgrade Panel when using Anaconda Cloud other_nb.md #6429

Closed
wants to merge 2 commits into from

Conversation

Coderambling
Copy link
Contributor

@Coderambling Coderambling commented Mar 3, 2024

Add a warning that ipywidgets + Panel does not work in Colab.

I think this should be pointed out in the documentation (I have wasted considerable time trying to get it to work, which is currently not possible due to Colab constraints regarding comms).

Maybe even add a warning in the code that detects use of ipywidgets + Colab and provides a warning in the Cell output?

See Discord message by @jbednar and surrounding messages here: https://discord.com/channels/1075331058024861767/1088157184489164831/1206732316513271818

And Github issue here: #6298

Added mention of Anaconda Cloud as a Notebook environment, and mention that users should upgrade Panel when using it. I am not sure what the correct / optimal !pip install command is. The specific command should probably be added, but at least this gives users a heads-up.

Should Panel have code that checks its own version, and produces a warning if the latest version is not being used?

That would seem sensible, also to alert users in local environments that are currently on the latest version, but might not be when the next version comes out. So this would provide them with a heads-up.

Added warning that ipywidgets + Panel does not work in Colab.

I think this should be pointed out in the documentation (I have wasted considerable time trying to get it to work, which is currently not possible due to Colab constraints regarding comms). 

Maybe even add a warning in the code that detects use of ipywidgets + Colab and provides a warning in the Cell output?

See Discord message by @jbednar and surrounding messages here: https://discord.com/channels/1075331058024861767/1088157184489164831/1206732316513271818

And Github issue here: holoviz#6298

Added mention of Anaconda Cloud as a Notebook environment, and mention that users should upgrade Panel when using it. I am not sure what the correct / optimal !pip install command is. The specific command should probably be added, but at least this gives users a heads-up.

Should Panel have code that checks its own version, and produces  a warning if  the latest version is not being used?

That would seem sensible, also to alert users in local environments that are currently on the latest version, but might not be when the next version comes out. So this would provide them with a heads-up.
@Coderambling Coderambling changed the title Update other_nb.md Added warning about use of ipywidgets with Panel in Colab, and to upgrade Panel when using Anaconda Cloud other_nb.md Mar 3, 2024
@Coderambling
Copy link
Contributor Author

Maybe change the text to explain that this applies not only to Colab, but to any other environments that use the ipywidgets interface to render output? What are those other environments?

@@ -8,6 +8,12 @@ This guide addresses how to develop apps in Google Colab, VSCode, nteract, and o

In the Google Colaboratory notebook, first make sure to load the `pn.extension()`. Panel objects will then render themselves if they are the last item in a notebook cell. Please note that in Colab rendering for each notebook cell is isolated, which means that every cell must reload the Panel extension code separately. This will result in somewhat slower and larger notebook than with other notebook technologies.

* Be aware: using Panel with ipywidgets in Colab does not work, due to Colab's architecture constraints.
Copy link
Collaborator

@MarcSkovMadsen MarcSkovMadsen Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest turning this into a nice warning admonition and making the text more specific.

:::{warning}
Panels [Ipywidget](../../reference/panes/IPyWidget.ipynb) pane does not work in Colab due to architecture constraints.
:::

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree but I'm not sure what the optimal text should be, in terms of warning (how are those usually formulated on the site?) and technical specifics.Does the Discord discussion I referred to help?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iteration: * Be aware: using ipywidgets with Panel in Colab does currentlly not work, due to Colab's architecture constraints.


### Anaconda Cloud

When using Anaconda Cloud, make sure to upgrade the Panel package to the latest version using !pip install
Copy link
Collaborator

@MarcSkovMadsen MarcSkovMadsen Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have a separate explanation on "Upgrading Panel" to link to instead of explaining it here.

It should 1) Describe how to upgrade with pip and conda 2) recommend upgrading param and bokeh together with Panel 3) recommend optionally upgrading hvplot and holoviews together with Panel. 4) Describe how to hard refresh the browser if no output is displayed 5) remember users to upgrade the jupyter lab python environment at the same time.

We should also link to this guide from the "Installing Panel" guide.

Copy link
Contributor Author

@Coderambling Coderambling Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. New users need to be aware of the above at earliest opportunity, otherwise they will run into silent fails / confusion, non-working doc exampples, and become frustrated and potentially walk away.

That's why I feel strongly that, as wel as documenting it, Panel should check itself and its environment after initializing, and emit the appropriate warning in the output. That seems the surest way to alert users.

So I guess a warning that is generated when doing import panel . Should that be a separate PR? This would also help to prevent users from running into this, and then asking questions from all kinds of angles on the forums, because they don't realize the root cause. Agree?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting we check (and warn if we are not on the latest version) for the latest version of Panel while importing it?

Copy link
Contributor Author

@Coderambling Coderambling Mar 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes absolutely! Just makes sense. People with a Python background may do this by default, but beginning users / people with different backgrounds like data science may not realize this. Especially relevant because Panel has a new version frequently.

And (separately(?) generating a warning regarding ipywidgets as indicated above. Ideally, in these situations:

  1. During / after import when Panel is in Colab
  2. When users use a panel (in Colab at least) without running pn.extension() first, a warning is generated that pn.extension must be used to display Panel. In a Colab context, the warning about ipywidgets should be shown below that.
  3. When user uses ipywidgets in Colab (or other environments with the same limitation).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm strongly -1 on Panel checking to see if it's the latest version on import. Once someone writes an app, that app should stay working forever on the older Panel version, and there's no reason for someone to upgrade if they aren't using new features or bugfixes. Using old versions is a feature, not a bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The real problem here continues to be lack of versioning for our docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jbednar Totally agree that it shouldn't break older apps. I am just talking about generating a warning in output / console. Could that in itself causes issues?

With "checking on import" I meant:

-import panel as pn -> Produces warning in output that "... Your Panel version is x, while latest version is y".

Would such a warning in any way cause issues, or impede an app from still working on an older version?

In that case, only show the warning on import panel as pn is the last statement in a file or Notebook cell?

Or only in console or debugger?

Totally agree apps should stay working on older version.

I did NOT mean: do import panel as pn, then anything else happens, besides showing a warning.

Do you agree there is an added value to such a warning?

Advantages:

-Informs users there is a new version available.
-Incentivizes them to look at new version and features of Panel when they revisit their old app after a while.
-Could encourage users to upgrade, and therefore reduce the installed base of older Panel versions that are more and more obsolete.

Separately, I have proposed some changes earlier to the docs to provide a heads-up on this for (new) users.

Maybe add something in addition to the getting started / installation like: "New Panel versions are released regularly. Please be aware of this, and consider testing and upgrading your app to take advantage of new features and improvements".

One question is: do most users of Panel already know there are frequent versions changes, and that they should take that into consideration?

-People with a Python background: probably.
-Data Science background: maybe not so much?
-Users new to Panel: ?
-Other (future) target groups?

I don't suppose there is any data on the main groups of people using Panel?

Another approach: would it be easy to do Github queries that check, for example, how many old forks of Panel exist? Don't know if that would be a useful metric, but maybe another Github query might reveal insights? Or volume of !pip install vs. !pip install -U over the years? Sorry if this is silly / wrong / irrelevant :-)

Copy link
Contributor Author

@Coderambling Coderambling Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main point is that users should be alerted in any way possible to things like the Colab issue / older versions.

Any type of warning, even if imperfect, is better than failing silently, or with errors that do not make clear what the root cause is.

@Coderambling
Copy link
Contributor Author

When using Anaconda Cloud, make sure to upgrade the Panel package to the latest version using !pip install

Alternative:

When using existing / hosted environments, make sure to check the version of Panel and upgrade the Panel package to the latest version using !pip install . Some of these environments, for example Anaconda Cloud, do not always have the latest version of Panel installed.

@Coderambling Coderambling changed the title Added warning about use of ipywidgets with Panel in Colab, and to upgrade Panel when using Anaconda Cloud other_nb.md Add warning about use of ipywidgets with Panel in Colab, and to upgrade Panel when using Anaconda Cloud other_nb.md Mar 13, 2024
@Coderambling
Copy link
Contributor Author

Anywidget is considering a similar solution regarding detection of supported environments here:
manzt/anywidget#37

@Coderambling
Copy link
Contributor Author

Hi all. Is there any Github action required by me at this time regarding this PR?

@philippjfr
Copy link
Member

This has been addressed in another PR.

@philippjfr philippjfr closed this Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants