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

IPyKernel not detected as Conda environment is not loading #6644

Closed
claudiaregio opened this issue Jul 12, 2021 · 29 comments
Closed

IPyKernel not detected as Conda environment is not loading #6644

claudiaregio opened this issue Jul 12, 2021 · 29 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)

Comments

@claudiaregio
Copy link
Contributor

claudiaregio commented Jul 12, 2021

Environment data

  • VS Code version: 1.58
  • Jupyter Extension version: v2021.8.1013163132
  • Python Extension version: v2021.6.944021595
  • Pylance Extension version: v2021.7.2

Steps to reproduce:

  1. Follow instructions here https://github.com/holoviz/holoviz/blob/master/doc/installation.rst but replace "anaconda-project run jupyter notebook" command with "anaconda-project run", followed by "code ."
  2. Open "Setup" notebook
  3. Change Python interpreter to the provided holoviz one
  4. Reload to resolve diagnostics
  5. Reload again and select corresponding kernel to holoviz env
  6. Try to run first code cell
  7. Get modal message prompting to install ipykernel, select install

Expected behavior

For ipykernel to install and be able to run cells

Actual behavior

Stuck in endless loop of being told to install ipykernel when trying to run cell

**Edit: I checked in through Conda CLI that ipykernel is actually installed here, yet I am stuck in the endless loop because it appears not to be finding it.

@claudiaregio claudiaregio added the bug Issue identified by VS Code Team member as probable bug label Jul 12, 2021
@claudiaregio claudiaregio changed the title Stuck in endless loop, being prompted to install ipykernel ipykernel not found in env that has it Jul 12, 2021
@DonJayamanne DonJayamanne self-assigned this Jul 15, 2021
@DonJayamanne
Copy link
Contributor

DonJayamanne commented Jul 22, 2021

@claudiaregio Please could you try this again & upload the logs from Jupyter output panel.
FYI - it works for me.

@rdillinger
Copy link

rdillinger commented Jul 23, 2021

This just started for me today - everything worked fine yesterday, no changes, didn't even close my code down, went to run today and getting message that ipykernel is not installed or needs updated.

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Jul 23, 2021

@rdillinger Sorry to hear that, Please could you create a new issue with the details requestd in the issue template.

@rdillinger
Copy link

Hi, yes, happy to, can you remind me what steps I need to take to get the complete log output? The main jupyter error I'm getting is that it is trying to exec an import ipykernel and failing (this either wasn't happening yesterday or wasn't failing yesterday).

Info 2021-07-23 14:50:54: Process Execution: > ~\anaconda3\python.exe -c "import ipykernel"

~\anaconda3\python.exe -c "import ipykernel"
Info 2021-07-23 14:50:54: Process Execution: > ~\anaconda3\python.exe -c "import ipykernel"
~\anaconda3\python.exe -c "import ipykernel"
Error 2021-07-23 14:50:59: Install Missing Dependencies, Class name = w, completed in 11234ms, has a falsy return value, Return Value: undefined [a [Error]: IPyKernel not installed into interpreter Python 3.7.3 64-bit ('anaconda3': conda):C:\Users\dillinra\anaconda3\python.exe
at w.handleKernelDependencyResponse (c:\Users\dillinra.vscode\extensions\ms-toolsai.jupyter-2021.8.1054968649\out\client\extension.js:90:246461)
at w.installMissingDependencies (c:\Users\dillinra.vscode\extensions\ms-toolsai.jupyter-2021.8.1054968649\out\client\extension.js:90:245644)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)] {
category: 'noipykernel',
reason: 1
}
Error 2021-07-23 14:50:59: Raw session failed to start because dependencies not installed
Info 2021-07-23 14:50:59: Shutdown session -- complete

@DonJayamanne
Copy link
Contributor

@rdillinger

  • What version of Jupyter extension do you have now?
  • Please could you roll back to the previous version of the Jupyter extension & try it out

@rdillinger
Copy link

@DonJayamanne - I just tried every extension back 5 months. Extensions prior to one month ago results in a complete "cannot launch notebook" error. Extension versions within the last month all (now) are resulting in the same kernel error and log results.

This was generated with Jupyter version 2021.6.999406279.

Info 2021-07-23 16:12:21: Starting raw kernel Python 3.7.3 64-bit ('anaconda3': conda)
Info 2021-07-23 16:12:21: installMissingDependencies C:\Users\dillinra\anaconda3\python.exe
Info 2021-07-23 16:12:29: Cached data exists getEnvironmentVariables,
Info 2021-07-23 16:12:30: Process Execution: > ~\anaconda3\python.exe -c "import ipykernel"

~\anaconda3\python.exe -c "import ipykernel"
Info 2021-07-23 16:12:30: Process Execution: > ~\anaconda3\python.exe -c "import ipykernel"
~\anaconda3\python.exe -c "import ipykernel"
Error 2021-07-23 16:12:36: Install Missing Dependencies, Class name = w, completed in 14749ms, has a falsy return value, Return Value: undefined [a [Error]: IPyKernel not installed into interpreter Python 3.7.3 64-bit ('anaconda3': conda):C:\Users\dillinra\anaconda3\python.exe
at w.handleKernelDependencyResponse (c:\Users\dillinra.vscode\extensions\ms-toolsai.jupyter-2021.6.999406279\out\client\extension.js:90:244702)
at w.installMissingDependencies (c:\Users\dillinra.vscode\extensions\ms-toolsai.jupyter-2021.6.999406279\out\client\extension.js:90:244075)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)] {
category: 'noipykernel',
reason: 1
}
Error 2021-07-23 16:12:36: Raw session failed to start because dependencies not installed
Info 2021-07-23 16:12:36: Shutdown session -- complete

@DonJayamanne
Copy link
Contributor

DonJayamanne commented Jul 23, 2021

@rdillinger
So it doesn't work in any version of Jupyter. Hence I dont think its a regression at our end.
Please could you do me a favor, please ensure you have

  • the latest version of the Jupyter extesnion.
  • The insider version of python extension (install Python extnsion & go into command palette & select Python Switch to Daily Insiders, wait for it to get installed & when promped restart VS Code)

Next Replicate the issue & then:

  • Please instal
  • Copy all of the output from the Jupyter output panel, and upload that here.
  • Screenshot of VSCode (I'd like to see the Kernel selected, on the top right)./
  • Provide the following information:
    • Are you using the base conda environment or a specific conda environment
  • Try the following in a terminal
    • Activate the conda environment you are using in the notebook
    • Run the following code
    • python -c 'import ipykernel;print(ipykernel.__version__)'
    • Let me what you get

@rdillinger
Copy link

Hi, Yes.
image
I will be back in a moment with the log after using the most current extension version.

@rdillinger
Copy link

rdillinger commented Jul 23, 2021

JupyterError Output Log.txt

This is with Jupyter most recent extension version, Python most recent extension version

Provide the following information:

  • Are you using the base conda environment or a specific conda environment - I have the python path specified (same path I was using yesterday).
  • Activate the conda environment you are using in the notebook - when I try to run conda activate conda in terminal, it gives me an error message about conda not being a recognized command
  • Run the following code - python -c 'import ipykernel;print(ipykernel.version)'. Let me what you get - I ran this, I received no error message, but also, no output.

@rdillinger
Copy link

The main thing is that everything has worked very well for months, then today it just stopped - I hadn't run any package upgrades, version upgrades, and I hadn't even closed my code. I just walked away from computer, and when I came back, I was getting the error message in the screenshot above.

After troubleshooting today, I'm not sure if the logs would be identical to ones I would have seen when this message first appeared, but I appreciate your help!

@DonJayamanne
Copy link
Contributor

@rdillinger are you still running into this issue with the latest versions of the Python & Jupyter extesnions?

@DonJayamanne DonJayamanne added the info-needed Issue requires more information from poster label Sep 1, 2021
@rdillinger
Copy link

rdillinger commented Sep 1, 2021 via email

@DonJayamanne DonJayamanne added notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel) and removed notebook-getting-started labels Sep 1, 2021
@DonJayamanne
Copy link
Contributor

Can you launch Jupyter using the command line? Out side vs code?
Based on your previous messages this seems to be the case. Meaning something else has changed outside vscode.

ctivate the conda environment you are using in the notebook - when I try to run conda activate conda in terminal, it gives me an error message about conda not being a recognized command

This would happen with updates to the OS or the like (that results in changes to your startup shell scripts, hence breaking conda in the terminals)

@DonJayamanne
Copy link
Contributor

Please confirm it works in your terminal. if not, then i'm sorry, but I'm not sure we can do anything as its outside the control of VS Code.
You might want to check setting up conda for your shell conda init or the like.

@rdillinger
Copy link

rdillinger commented Sep 1, 2021 via email

@DonJayamanne
Copy link
Contributor

How would I get it running again?

  • Use the conda command prompt and run conda init
  • Open your terminal and run conda init (if that doesn't work then <fully qualified path to conda> init.

@rdillinger
Copy link

rdillinger commented Sep 1, 2021 via email

@DonJayamanne
Copy link
Contributor

Thanks, I'm closing this issue as its outside the control of VS Code.
Do let us know if that works.

@rdillinger
Copy link

rdillinger commented Sep 1, 2021 via email

@DonJayamanne DonJayamanne reopened this Sep 1, 2021
@DonJayamanne
Copy link
Contributor

ran the conda inits, and that did not resolve the error.

THanks for the feedback, however I'm a little confused now.

  • Does conda work in the terminal in vscode (using VS Codes termina)?
  • Does conda work in the terminal outside vscode?
  • Please could you provide the following information:
    • VS Code version
    • Jupyter extenison version
    • Conda version
    • Python version
    • Outputs from your Jupyter Output panel when you get the errors

@rdillinger
Copy link

rdillinger commented Sep 1, 2021 via email

@rdillinger
Copy link

rdillinger commented Sep 1, 2021 via email

@DonJayamanne
Copy link
Contributor

but it does work outside of vscode in both the anaconda terminal and the regular terminal.

  • What's your terminal inside vscode & outside vscode?
  • Try toggling the value in your settings to see if this makes a difference (please try true & false)
    terminal.integrated.inheritEnv

Hi, also, regarding output, I only get two pop up boxes,

Go into the command palette and select Jupyter: Show Output. on the bottom you'll see an output panel with the name Jupyter, please copy the contents from that screen (you might want to maximize the screen to copy all of the output)

@rdillinger
Copy link

rdillinger commented Sep 2, 2021 via email

@DonJayamanne DonJayamanne changed the title ipykernel not found in env that has it IPyKernel not detected as Conda environment is not loading Sep 3, 2021
@DonJayamanne
Copy link
Contributor

DonJayamanne commented Sep 3, 2021

Thanks for the information.
Ok, so it looks like conda isn't working at all in VS Code.
Basically this isn't a problem with the extension or VS Code, but something to do with the configuration at your end (i.e configuring conda to work in other shells/environments).

Here are a few things i'll need:

  • In vscode
    • What shell are you using? Powershell or command prompt or other?
    • Open a terminal in VSCode and run the following & please provide the output for each:
      • `conda --version
      • conda env list
      • python -c 'import sys;print(sys.executable)'
      • python --version
  • Outside vscode:
    • What shell are you using? Powershell or command prompt or other?
    • How do you run conda? Do you use anaconda launcher or the like or just open your shell like command prompt and just run conda
    • How are you launching jupyter, what are the exact commands used to launch jupyter outside vscode?
      • Do you run conda activate xyz & then run jupyter... or pytohn -m jupyter notebook...
    • Just before you run jupyter in your terminal outside vscode please take a screenshot of your terminal, i'd like to see what environment is activated.
    • Just before you run jupyter in your terminal outside vscode please run the following & provide me the output:
      • `conda --version
      • conda env list
      • python -c 'import sys;print(sys.executable)'
      • python --version

@rdillinger
Copy link

rdillinger commented Sep 3, 2021 via email

@DonJayamanne
Copy link
Contributor

Please could you provide the information requested. Thanks

@rdillinger
Copy link

rdillinger commented Sep 7, 2021 via email

@DonJayamanne
Copy link
Contributor

Closing this issue as its been over 4 weeks, since the information was requested.
We'll be happy to reopen the issue when the requested information has been provided.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 8, 2022
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 info-needed Issue requires more information from poster notebook-execution Kernels issues (start/restart/switch/execution, install ipykernel)
Projects
None yet
Development

No branches or pull requests

4 participants