I had a similar issue. I had to configure a setting through VS Code's command palette:
"Python: Select Interpreter to Start Jupyter server"
and select an environment with Jupyter installed, to allow VS Code to start the server.
For reference: https://github.com/microsoft/vscode-python/issues/11048
Answer from jmarlow on Stack OverflowI had a similar issue. I had to configure a setting through VS Code's command palette:
"Python: Select Interpreter to Start Jupyter server"
and select an environment with Jupyter installed, to allow VS Code to start the server.
For reference: https://github.com/microsoft/vscode-python/issues/11048
In VS Code you can go to command palette by ctrl+shift+P and type jupyter and you will get a dropdown and select filter kernels it should activate your jupyter sessions.
Check the kernel specifications:
$jupyter kernelspec list
This will show you the available kernels. In this case:
python3 /usr/local/etc/jupyter/kernels/python3
Open the kernel.json file in this directory and specify the path of python you want the kernel to use in the argv key.
Updating the jupyter notebook resolved the issue for me. But remember, update it using command line. Not Anaconda Navigator
pip install -U jupyter
This sounds like it might be a bug that found in the 2023.1 version of the Jupyter extension that affects MacOS users: Starting a Jupyter server kernel fails (when zmq does not work) #12714 (duplicates: Failed to start the Kernel, version v2023.1.2000312134 #12726, Jupyter server crashed. Unable to connect. #12746) The solution recommended there was to switch to the pre-release version while waiting for the fix to come to the regular-release-channel released the fix. Others in the threads there also found that rolling back to older extension versions also worked for them (you can rollback clicking into the down menu button next to the extension's uninstall button).
If none of those solutions work, try this:
pip install --upgrade --force-reinstall --no-cache-dir jupyter
And then restart VS Code. If you already have it open, you can do this in the VS Code command palette with the Developer: Reload Window command.
Credit: The above command is based on this answer by @Spandana-r to the question After installing with pip, "jupyter: command not found".
Close the vscode then uninstall jupyter and notebook one after another.
- pip uninstall jupyter
- pip uninstall notebook
Now, open vs code and run cell like. print ("Hello") Vscode will ask you to download jupyter. Allow it. Now It is ready to work.
I got the same error message because the jupyter package was missing in my selected environment.
pip install jupyter
resolved the problem for me.
From the official VS Code documentation:
To work with Python in Jupyter Notebooks, you must activate an Anaconda environment in VS Code, or another Python environment in which you've installed the Jupyter package.
Could you try to reinstall the pyzmq module?
pip uninstall pyzmq
pip install pyzmq==19.0.2
The version number may be different depending on the jupyter-client version.
There is a likelihood that you've updated Tornado to 6.0.0 recently. Try reinstalling it to version 5.1.1. It just helped me. Lost 1 hour of precious Saturday time on this.
Create a conda environment using:
conda create -n my_env python=3
Activate the environment using:
source activate my_env
Install the ipykernel using:
conda install ipykernel
ipython kernel install --name my_env --user
Now open the jupyter and select the "my_env" from Kernel option. ( path : jupyter -> kernel -> change kernel -> my_env )