简体   繁体   中英

jupyter server : not started, no kernel in vs code

i am trying to use jupyter notebooks from vs code and installed jupyter notebook extension and i am using (base)conda environment for execution. while this happened

Error: Jupyter cannot be started. Error attempting to locate jupyter:
at A.startServer (c:\Users\DELL\.vscode\extensions\ms-python.python-2020.2.63990\out\client\extension.js:1:784356)
at async A.ensureServerAndNotebookImpl (c:\Users\DELL\.vscode\extensions\ms-python.python-2020.2.63990\out\client\extension.js:1:783811)
at async A.ensureServerAndNotebook (c:\Users\DELL\.vscode\extensions\ms-python.python-2020.2.63990\out\client\extension.js:1:783612)
at async A.submitCode (c:\Users\DELL\.vscode\extensions\ms-python.python-2020.2.63990\out\client\extension.js:1:780564)
at async A.reexecuteCell (c:\Users\DELL\.vscode\extensions\ms-python.python-2020.2.63990\out\client\extension.js:75:879318)

jupyter笔记本的状态

how to resolve this issue?

I had exactly the same problem when I installed Visual Studio Code and tried to run some Python code from a jupyter notebook on my fresh Ubuntu 18.04.

How I solved it:

1) Press Command+Shift+P to open a new command pallete

2) Type >Python: Select Intepreter to start jupyter notebook server

3) Open the notebook again

And it worked fine. Hope it works for you.

I have several versions of Python installed. It happened the same thing to me and I have fixed it this way. Ctrl+Shift+p and select Python: Select Interpreter to start Jupyter server 在此处输入图像描述

Then, select the version under the Visual Studio Code在此处输入图像描述

Nothing will happen and then press again Ctrl+Shift+p and select Python: Create new blank Jupyter Notebook. And it works

I have even set the Python version to 3.8 at the bottom and it worked too with the new features print(a:=4) despite the fact that the version I have chosen was 3.7.5. Nevertheless, I have to lunch VS Code from Anaconda Navigator.

在此处输入图像描述

  1. Press Command+Shift+P on mac, Ctrl+Shift+p on windows

  2. Type Jupyter: Select Interpreter to start Jupyterserver

  3. It would show you a dropdown of python versions installed.

  4. I chose python 3.7.5 and it worked for me you can choose the python version installed on your machine.

我已经看到了所有可能的解决方案但不起作用,最后我只是升级jupyternotebookjupyterlab ,比如pip3 install -U jupyterlab ,我可以在 VScode 中选择内核!

I tried the following:

  1. Press Command + SHIFT + P
  2. Type Python: Select Interpreter to start Jupyterserver

Hope this answer was helpful.

Making sure that in VS Code settings.json

"python.condaPath": "C:\\Program Files\\miniconda3\\Scripts\\conda.exe"

is pointing to the correct directory. It solved it for me.

just fix this by add

"python.terminal.activateEnvironment": false,

to settings.json

hopes this help.

just had the same issue and it did not help to update the interpreter within vscode. What helped was: Check your dependencies within pip! It seems that new dependencies came up with the latest update of python, which are not installed. For me this was pygments:

jupyter-console 6.2.0 requires pygments, which is not installed.

Linux solution step-by-step:

xyz@xyz-pc-ubuntu:~$ pip3 check
qtconsole 4.7.6 requires pygments, which is not installed.
nbconvert 5.6.1 requires pygments, which is not installed.
jupyter-console 6.2.0 requires pygments, which is not installed.
ipython 7.18.1 requires pygments, which is not installed.

xyz@xyz-pc-ubuntu:~$ pip3 install pygments
Successfully installed pygments-2.7.2

Afterwards, jupyter found the updated python interpreter automatically.

我遇到了同样的问题,这解决了我的问题https://www.reddit.com/r/vscode/comments/eq2bfv/vs_code_jupyter_server_no_kernel_python_not/希望这有帮助

In my case, I had the server working in 3.7.6, but i wanted to use >3.8.0 versions too. After multiple attempts, which failed, I decided to:

  1. Uninstall 3.8.5, and delete the folder in the installation directory.
  2. Uninstall VSCode too.
  3. Restart the PC, and re-install Python and VSCode. As a result, the Jupyter server initiated based on the latest version of Python automatically.

I hope this helps too! Cheers!

我安装了 anaconda 并选择了 python 内核作为我的解释器(ctrl + shift + p),它解决了我的问题。

i've stumbled upon this post, since i had a similar issue. provided that my context was different, since i was working remotely on a linux server , even if i selected the right interpreter (via shift+ctrl+P "Select Interpreter to start Jupyter server") the kernel remained unactive. i've checked the installed dependencies inside the venv and tried to switch virtual environment to make it work.. kept on reloading the server, reloading the window.. no way.

eventually, a tiny fancy detail arouse my attention: the "Jupyter server : remote" label in the bottom right . and tadaa : that was my issue. I've selected "default", letting VSCode starting a server on the local (remote) host, and then the interpeter / kernel was enabled.

hope it can help anyone stuck on the same issue.1

I faced a similar issue quite often in VS Code, sometimes I can't get the kernel from my virtual enviroment (instead, VS Code only finds other venvs that are not related to my current project).

I tried reloading the window, selecting interpreter to start jupyter, reloading the VS Code itself , but nothing worked .

In case all the above and the other answers fail, try that, it worked for me:

  1. Ctrl+Shift+P
  2. Jupyter: Filter kernels
  3. Select only the kernel you want (in my case, my venv)
  4. Go on "Select Kernel" directly on the notebook UI;
  5. Select your right kernel.

It is weird that the venv kernel appears on "Filter Kernels", but not always appears on the kernel list. But doing this might solve the issue.

For me uninstalling the Jupyter extension, closing VS code and then reinstalling it worked. Not a really great solution, but the only one that worked for me. Hope that may help someone.

For me the problem is that VSCode can't find the kernel, even in using the select interpreter option.

The most reliable solution that I can find and currently used is:

  1. Install without cache:

     pip install jupyter notebook jupyterlab pyzmq --upgrade --no-cache-dir
  2. Restart VSCode


Another extra safety step is to uninstall first and followed with pip cache purge

I had a comparable problem when trying to run a jupyter notebook on a remote server . The problem was solved by installing the Python Extension on this particular server from the extensions menu in VSCode. After that, the correct kernel was automatically chosen in the jupyter notebook and I could run everything smoothly.

Fix this by going to settings and search for Environment, Under Extensions you'll find Python, Under python you can see a option called Python>Terminal: Activate Environment (Uncheck this box)

Then you can change your python interpreter to whichever version you like

hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM