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

New Virtual environments not listed in Kernels until i reload VS Code #5319

Closed
DonJayamanne opened this issue Mar 25, 2021 · 17 comments
Closed
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@DonJayamanne
Copy link
Contributor

  • Run notebook, & view kernels
  • Create virtual environment
  • Close notebook, open a notebook, the new venv is not dipslayed in the kernel picker
  • Need to reload
@DonJayamanne DonJayamanne added the bug Issue identified by VS Code Team member as probable bug label Mar 25, 2021
@greazer greazer added this to the August 2021 Release milestone Jun 5, 2021
@greazer greazer modified the milestones: August 2021, old August 2021 Aug 9, 2021
@rchiodo
Copy link
Contributor

rchiodo commented Aug 31, 2021

I think we need a refresh button like python has:

Us:
image

Python:
image

@rchiodo rchiodo added needs-triage bug Issue identified by VS Code Team member as probable bug and removed bug Issue identified by VS Code Team member as probable bug needs-inspection labels Aug 31, 2021
@greazer greazer added this to the October 2021 milestone Sep 2, 2021
@greazer greazer modified the milestones: October 2021, September 2021 Sep 2, 2021
@kylepierce
Copy link

This bug has made vscode notebooks unusable for me. I cannot select the appropriate virtualenv.

@greazer greazer modified the milestones: September 2021, October 2021 Sep 23, 2021
@DonJayamanne DonJayamanne changed the title New Virtual environments not listed in Kernels New Virtual environments not listed in Kernels until i reload VS Code Sep 23, 2021
@DonJayamanne DonJayamanne added the upstream-python Blocked on upstream Python Ext label Sep 23, 2021
@DonJayamanne
Copy link
Contributor Author

@DonJayamanne
Copy link
Contributor Author

DonJayamanne commented Oct 4, 2021

Depends on #7583
Suggestion

  • Refactor notebook controllers to use the new Python extension api (loading interpreters as and when they are discovered)
  • Big change, hence pointless trying to do that in this debt week

@rchiodo
Copy link
Contributor

rchiodo commented Dec 6, 2021

This should be fixed.

@rchiodo rchiodo closed this as completed Dec 6, 2021
@rzhao271 rzhao271 added the verified Verification succeeded label Dec 6, 2021
@cpoptic
Copy link

cpoptic commented Jun 9, 2022

As of June 2022, this issue is not fixed. Please re-open this issue and keep it open until a dependable, reliable fix has been implemented.

To users encountering this issue, one high-probability method I've found solves this persistent issue is to:

  • uninstall Jupyter Extension
  • uninstall Python Extension
  • Reload VS Code
  • Re-install Jupyter Extension
  • Re-install Python Extension
  • Open a Jupyter notebook
  • Select the desired kernel from the upper right corner of your notebook.

Uninstalling extension, reloading VS Code, and re-installing those extensions is currently the only dependable way of solving the mystery of missing kernels/environments in VS Code Jupyter notebooks, which is a less than ideal solution.

@rchiodo
Copy link
Contributor

rchiodo commented Jun 9, 2022

@cpoptic can you open a new issue? Creating a venv and refreshing the list of interpreters in the python extension works for me.

image

Perhaps we need a 'force refresh' button for kernels too. But kernels update when we detect from the python extension that a new environment was created.

Once I clicked refresh on the 'Select Interpreter' dialog, my kernel showed up:

image

@guidorice
Copy link

guidorice commented Nov 4, 2022

@rchiodo the problem seems to be with the "Select kernel" dialog which pops up when you run a notebook in VSCode.

  • The list of venvs is incomplete, or it apparently doesn't see the venv which the current Python interpreter is using in VSCode.
  • The list of venvs cannot be refreshed.
  • It doesn't have an affordance to enter a path.

Screen Shot 2022-11-04 at 3 55 41 PM

edit:

There seems to be some condition which triggers the current venv to appear in the picklist for 'select kernel'. Cannot quite figure out what that is. Have tried installing ipykernel, have tried running jupyter notebook , etc.

@rchiodo
Copy link
Contributor

rchiodo commented Nov 4, 2022

@guidorice I added a new issue for you (referencing your comment).

@Mascobot
Copy link

Mascobot commented Nov 8, 2022

Same issue here as @guidorice. The environments list seems to be incomplete (both from conda and virtualenv), and something seems to trigger some old envs that suddenly appeared, but the list is still incomplete. The normal interpreter works fine, but the issue only happens when you open Jupyter Notebook and try to "Select Kernel". No refreshing is available. So far I tried re-installing ipykernel, re-installing the JN extension, and saving the notebook inside the virtualenv environment folder. No success.

@haimengzhao
Copy link

haimengzhao commented Nov 10, 2022

Same issue here as @guidorice and @Mascobot. I'm currently using this work around:

  1. Manually execute jupyter notebook in a terminal with correct python environment
  2. Open the Command Palette and select Jupyter: Specify Jupyter Server for Connections
  3. Copy the URL http://localhost:8888/?token=blahblah from the terminal to it
  4. Now it will appear in the Kernel list as a (Remote) Jupyter Kernel.

@Mascobot
Copy link

Sweet. Nice work around. Just did it and it works.

@fabioxxt
Copy link

fabioxxt commented Dec 2, 2022

who still has this problem, I found that closing the ipynb file tab and opening it again solves it, if not, close the tab again and with the second mouse button, click on the ipynb file and open it with the terminal

@pablomassirer
Copy link

The only two solutions for me that seems to work until now is closing and reopening the file as mentioned above, or specifying the interpreter path in the "Python: Select Interpreter" from the Command Palette.

@DonJayamanne
Copy link
Contributor Author

Sorry everyone about this issue.
However we've fixed a big gap in the environment discovery by using the same API that Python extension uses to discovery Python environments.
You can try that out in the latest Jupyter relase (some time tomorrow or this week)
Optionally you can try that now with the latest vscode insiders and pre-release version of the Jupyter extension.

If this still does not work, please do ping here and we'll happily re-open this issue and look into it, or please feel free to create a new issue,.

@dmnburrows
Copy link

Hi, I'm still getting this issue - I have upgraded jupyter, and when I SSH into a remote server and launch a notebook I am unable to select a kernel. When I load the notebook it never detects a kernel, and when I press on the kernel button on the top right nothing happens. If i search for my kernels in the search bar at the top nothing appears. I don't have this issue when I am loading notebooks on my local machine. Any help would be much appreciated!

@DonJayamanne
Copy link
Contributor Author

@dmnburrows Please could you file a new issue for this, thanks
When creating the new issue please provide the logs below
Please could you enable logging as follows:

  • Open settings & go into Jupyter->Logging
  • Change the value to verbose
  • Reload VS Code,
  • Attempt to repro the issue & then copy the output from the Jupyter output panel.

@microsoft microsoft locked and limited conversation to collaborators Feb 2, 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 verified Verification succeeded
Projects
None yet
Development

No branches or pull requests