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

Ensure that we notify the user when an embedded jupyter kernel cannot be found on a user's machine OR it's not selected as the current python extension kernel #2366

Closed
greazer opened this issue Jan 30, 2020 · 14 comments
Assignees

Comments

@greazer
Copy link
Member

greazer commented Jan 30, 2020

Verify that on loading then running a cell in a notebook the user is notified if:

  1. The kernel embedded as metadata in the notebook can't be found on the user's machine. I think we do this for sure.
    OR
  2. The kernel embedded as metadata in the notebook doesn't match the currently selected python extension interpreter (regardless of whether it's found on the machine).

Daniel Moth ran into this problem (probably microsoft/vscode-python#2) and it was highly confusing as to what was happening. This was critical because he knew he needed to install some packages for the notebook to work, but it was really unclear to him where and how to make the changes.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 30, 2020

What happens for me is that there is no message and it just picks the kernel that matches the currently selected python.

Do we want to change this behavior? Why would the user care in most cases?

@rchiodo
Copy link
Contributor

rchiodo commented Jan 31, 2020

Repro steps:

  1. Start with a clean (no python anywhere) Windows machine.
  2. Install the latest Python from python.org (happens to be python 3.8)
  3. Try to run a cell in the notebook.
  4. Prompted to install jupyter (because a bare python was installed)
  5. Try to run a cell again. Fails because pytorch is needed.
  6. Install pytorch in a VS Code python terminal. Fails because of some powershell/pip incompatibility (unbeknownst to Daniel or us)
  7. Install latest Anaconda (I think this is Python 3.7.4).
  8. Install pytorch in a VS Code python terminal again. Fails again for the same reason as step 6.
  9. Start looking for reasons as to why pytorch can't be installed.
  10. The kernel spec in the notebook says Python 3.8. The selected interpreter is Python 3.7.4.
  11. Try to make the notebook kernel match the selected python interpreter. Can't be changed.
  12. Change the interpreter to Python 3.8 and start a new Python terminal.
  13. Powershell/pip is STILL a problem (since it's unrelated to everything being tried)
  14. Get really confused and frustrated as to what to do next threaten to use a different notebook tool.

@rchiodo
Copy link
Contributor

rchiodo commented Jan 31, 2020

We should RCA this to figure out what actually went wrong in step 11 (user couldn't change the kernel)

Additionally we might brainstorm on ideas to alleviate the confusion around kernel vs python.

@LSgeo
Copy link

LSgeo commented Feb 4, 2020

Hi, I think my issue is related.

  1. I have conda python 3 virtual environments, one named 'dev', one named 'mmsr', and others.
  2. VSCode starts in the 'dev' environment.
  3. I open a new notebook, and run the first cell.
  4. VSCode prompts installation of ipykernel, and I accept.
  5. Terminal opens and attempts to install ipykernel to the 'dev' venv, but it is already installed
  6. The notebook kernel then shows it is running the 'mmsr' venv.
  7. Clicking on the notebook kernel in the upper right to change kernels opens the change kernel prompt, but selecting the 'dev' kernel does nothing, other than revert to step 4.

@rchiodo
Copy link
Contributor

rchiodo commented Feb 4, 2020

@LSgeo your issue sounds like this:
https://github.com/microsoft/vscode-python/issues/9638

That should be fixed in our insider's build

@greazer
Copy link
Member Author

greazer commented Feb 6, 2020

We need to dig into all the potential issues here and split out any bugs we need to address.

@greazer greazer self-assigned this Feb 13, 2020
@greazer
Copy link
Member Author

greazer commented Feb 13, 2020

Talk with Rong and Jeffrey as to how to deal with this issue.

@IanMatthewHuff
Copy link
Member

Unassigned as this might be covered by @rchiodo 's work on microsoft/vscode-python#9250

@IanMatthewHuff IanMatthewHuff removed their assignment Mar 2, 2020
@rchiodo rchiodo self-assigned this Mar 2, 2020
@IanMatthewHuff IanMatthewHuff self-assigned this Mar 10, 2020
@IanMatthewHuff
Copy link
Member

@rchiodo this work done for this doesn't seem to totally match up with this bug title. I think your PR fixed invalid kernels. But if you just have a notebook with a non-existent kernel specified (like if you downloaded a notebook from github) then it just silently falls back on the active interpreter.

But it's a bit funky since this bug had so many different issues listed in it. Do we still want a warning in the case of a missing embedded kernel?

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Mar 10, 2020

(like if you downloaded a notebook from github) then it just silently falls back on the active interpreter.

I don't think it falls silently to the active interpreter. We have code that displays a message to the user and we notify that it could not be found.

@IanMatthewHuff Are you able to repro this (opening nb with non-existent kernel).

@rchiodo
Copy link
Contributor

rchiodo commented Mar 10, 2020

I can. It defaults to the active interpreter. You can do this quite easily by just changing the kernel to something goofy.

It just opens the notebook and picks the active interpreter. No message, not even a trace in the debugger.

@IanMatthewHuff
Copy link
Member

Yup, it's silent. Just uses active interpreter.

@IanMatthewHuff
Copy link
Member

IanMatthewHuff commented Mar 10, 2020

Looking at the code it will notify if it needs to install a kernel for the interpreter. But if that interpreter already has a kernel installed it's silent.

Should be a quick little change. I'll pull it back to in-progress and add the message for the case where the active interpreter is already installed.

@rchiodo
Copy link
Contributor

rchiodo commented Mar 16, 2020

Validated

@rchiodo rchiodo closed this as completed Mar 16, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Mar 27, 2020
@microsoft microsoft unlocked this conversation Nov 13, 2020
@DonJayamanne DonJayamanne transferred this issue from microsoft/vscode-python Nov 13, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants