flekschas / jupyter-scatter

Interactive 2D scatter plot widget for Jupyter Lab and Notebook. Scales to millions of points!
https://jupyter-scatter.dev
Apache License 2.0
390 stars 17 forks source link

Warning in colab #93

Closed domoritz closed 1 year ago

domoritz commented 1 year ago

When I use the widget in colab, I get this warning

/usr/local/lib/python3.10/dist-packages/anywidget/_util.py:201: UserWarning: anywidget: Live-reloading feature is disabled. To enable, please install the 'watchfiles' package.
  start_thread=_should_start_thread(maybe_path),

Code

import jscatter
import numpy as np

x = np.random.rand(500)
y = np.random.rand(500)

jscatter.plot(x, y)
flekschas commented 1 year ago

Oh, I've seen this warning before. It's related to anywidget and shouldn't impact the widget at all. I actually wonder why this warning is shown as it should really only appear in development mode. @manzt Any idea if this is expected?

manzt commented 1 year ago

hey! We turn on auto-reloading when packages is outside of site-packages:

https://github.com/manzt/anywidget/blob/65c03e0887683d760bb05de29df92f29dc8ae57e/anywidget/_util.py#L169

I'd be happy to also ignore dist-packages

flekschas commented 1 year ago

@manzt it seems like for Colab, the packages are always located outside of site-packages which generates the warning.

Screenshot 2023-09-15 at 7 23 58 PM

Not sure it's possible to detect in which environment a widget is installed but if it is maybe the warning can be limited to Jupyter environments where the package is outside the site-packages folder?

manzt commented 1 year ago

should be fixed in anywidget v0.6.4

flekschas commented 1 year ago

Awesome thanks!