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

Interactive Widgets fail on Apple Silicon, Remote Jupyter & when using non-Raw kernels #8378

Closed
evgenyneu opened this issue Nov 29, 2021 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ipywidgets Rendering, loading, saving, anything to do with IPyWidgets verified Verification succeeded
Milestone

Comments

@evgenyneu
Copy link

evgenyneu commented Nov 29, 2021

Environment data

  • VS Code version: 1.62.3
  • Jupyter Extension version: v2021.10.1101450599
  • Python Extension version: v2021.11.1422169775
  • OS and version: macOS Monterey 12.0.1 running on AppleSilicon Mac
  • Python version: 3.9.5
  • Type of virtual environment used: venv
  • Jupyter server running: Local

Expected behaviour

As you move a slider the function is called multiple times.

Actual behaviour

The function is called once.

Steps to reproduce:

  • Create a Jupiter notebook with this code, which contains a slider.
from ipywidgets import interact

def f(x):
  print(x)
    
interact(f, x=10);
  • Open it in VSCode, move the slider.

Expected behaviour

The widget calls the function f multiple times as you move the slider.

Actual behaviour

The function f is only called once at the beginning:

demo_m1

Notes

  • I could only see the bug on Apple Silicon Mac and not on my Intel Mac.

  • The widget works as expected on Apple Silicon Mac if opened in jupuyter-lab instead of VSCode.

Repository that reproduces the bug

https://github.com/evgenyneu/ipywidgets_vscode_bug

@evgenyneu evgenyneu added the bug Issue identified by VS Code Team member as probable bug label Nov 29, 2021
@DonJayamanne
Copy link
Contributor

Please could you try the latest VS Code insiders version.
Its possible this has been fixed in there. I'm unable to repro this in VS Code insiders.

  • Install VSCode insiders from here https://code.visualstudio.com/insiders/
  • Install Jupyter extesnsion (in VS Code Insiders you'll automatically get the latest dev version of Jupyter extension built daily from our main branch)

@DonJayamanne DonJayamanne added info-needed Issue requires more information from poster ipywidgets Rendering, loading, saving, anything to do with IPyWidgets labels Nov 29, 2021
@evgenyneu
Copy link
Author

@DonJayamanne I installed Apple Silicon version of VS Code Insiders. Same problem unfortunately.

  • VS Code version: 1.63.0-insider
  • Jupyter Extension version: v2021.11.1001515174
  • Python Extension version: v2021.11.1422169775

@DonJayamanne
Copy link
Contributor

Weird, works for me with the same python packages.
Please could you try another Python environment, possible something hasn't been installed correctly.
Also, please could you install jupyter & notebook into the same environment (python -m pip install jupyter notebook) and run Jupyter from there python -m jupyter notebook and run the same code to see whether it works.

@evgenyneu
Copy link
Author

Thanks, @DonJayamanne

Tried both conda and venv environments (see commands below), still have this problem in both. Tried python installed by conda and asdf, same problem. Tried different Python versions (3.9.5, 3.10.0, 3.8.11), no difference.

Conda

conda create --name widgets_demo python=3.10
conda activate widgets_demo
python -m pip install jupyter notebook

venv

python -m venv .venv
. .venv/bin/activate
python -m pip install jupyter notebook

run Jupyter from there python -m jupyter notebook and run the same code to see whether it works

The problem does not exist in Jupyter notebook when I run it normally (in the web browser). Everything works fine. The problem only exist in the Apple Silicon version of VS code.

@evgenyneu
Copy link
Author

evgenyneu commented Nov 30, 2021

Here is a demo video (with sound). TLDR: I downloaded both Intel and Apple Silicon versions of VS Code Insiders. The widget works fine in Intel but not in Apple Silicon version of VS Code.

vscode_widget_demo_intel_vs_arm.mp4

@DonJayamanne
Copy link
Contributor

@evgenyneu Thanks for your patience, I'e identified the problem and should be able to get this fixed.

@DonJayamanne DonJayamanne changed the title Widgets only call function once on Apple Silicon Interactive Widgets fail on Apple Silicon, Remote Jupyter & when using non-Raw kernels Nov 30, 2021
@DonJayamanne DonJayamanne added this to the November 2021 milestone Nov 30, 2021
@DonJayamanne DonJayamanne removed the info-needed Issue requires more information from poster label Nov 30, 2021
@DonJayamanne
Copy link
Contributor

Verified here #8407 (comment)

@DonJayamanne
Copy link
Contributor

Testing steps

  • Use non-raw
  • Create a cell with teh code:
from ipywidgets import interact

def f(x):
  print(x)
    
interact(f, x=10);
  • Run the cell & move the slider
  • Confirm the outputs are updated (both counters)

In stable, this will not work with remote or non-raw.
Now this should work in raw, non-raw & remote

@evgenyneu
Copy link
Author

I can confirm the bug is fixed in VS Code insiders Apple Silicon build.

  • VS Code: 1.63.0-insider Commit: 0cc0904c565399781defa830facf43141db8b6f3
  • Jupyter extension: v2021.11.1001524965
  • Python extension: v2021.11.1422169775

@antonindurieux
Copy link

I notice that the bug seems to reappear if the Jupyter kernel is restarted (with VS Code Version : 1.63.0-insider (Universal)).

@DonJayamanne
Copy link
Contributor

@antonindurieux thanks for finding that, I've created an issue for that here #8431

@DonJayamanne
Copy link
Contributor

@antonindurieux
I've managed to identify the fix and got a PR open for this.

@DonJayamanne
Copy link
Contributor

Testing steps

  • Connect to a remote Jupyter server
  • Create a cell with teh code:
from ipywidgets import interact

def f(x):
  print(x)
    
interact(f, x=10);
  • Run the cell & move the slider
  • Confirm the outputs are updated (both counters)
  • Restart the kernel and re-run the cell and confirm its rendered

@DonJayamanne
Copy link
Contributor

Closing as done for verification

@roblourens roblourens added the verified Verification succeeded label Jan 31, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug ipywidgets Rendering, loading, saving, anything to do with IPyWidgets verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants