Skip to content

Does not work on MacOS #3965

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

Open
ruidazeng opened this issue Nov 15, 2024 · 3 comments
Open

Does not work on MacOS #3965

ruidazeng opened this issue Nov 15, 2024 · 3 comments

Comments

@ruidazeng
Copy link

ruidazeng commented Nov 15, 2024

Jupyter notebook version: latest, just brew installed it.

Installation in Jupyter notebook

# Install matplotlib for data visualization
%matplotlib 
!pip install matplotlib

!pip install ipywidgets

Usage:

interact(plot_distribution, year=widgets.IntSlider(min=1, max=10, step=1, value=2))

It shows this as an output instead of a functioning slider:

interactive(children=(IntSlider(value=2, description='year', max=10, min=1), Output()), _dom_classes=('w…
<function __main__.plot_distribution(year)>
@baggiponte
Copy link

Same for me. I tried this:

cd "$(mktemp -t scratch --directory)"
uv init --name=test --python=3.12
uv add --dev jupyterlab ipywidgets

then wrote

from ipywidgets import IntSlider

slider = IntSlider()

print(slider.value ** 2)

Got:

image

My user agent is: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' I am on Arc but get the same problems on Chrome and Safari.

@ruidazeng ruidazeng changed the title Does not work on Jupyter notebook (or Jupyter Lab) Does not work on MacOS Nov 19, 2024
@manzt
Copy link
Contributor

manzt commented Mar 18, 2025

then wrote

In order to see the widget it must be the last item in the cell or explicitly displayed with display(slider). Try breaking up your example into two cell blocks

from ipywidgets import IntSlider

slider = IntSlider()
slider
print(slider.value ** 2)

@dcurrie
Copy link

dcurrie commented Apr 24, 2025

I was able to fix this by installing jupyterlab_widgets into the same python environment as jupyterlab.

In my case, the kernel I am running is in a separate environment from jupyterlab's, and it had ipywidgets installed, but the plugin for jupyterlab is needed in its environment.

Also, I'd used homebrew to install python and jupyterlab, and it has no formula for jupyterlab_widgets. So I had to force the issue with pip3 install --user --break-system-packages jupyterlab_widgets

Neither of these things may be affecting you, but it may be a good idea to confirm that your jupyter has the appropriate plugin.

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

No branches or pull requests

4 participants