notebook: Getting Kernel Error while running Jupyter Notebook in Python3

I am getting a kernel error while running Jupyter Notebook in python 3 .On running

Jupyter kernelspeclist I am getting- Available kernels: python3 /home/rishav/.local/share/jupyter/kernels/python3 python2 /usr/local/share/jupyter/kernels/python2 I am running it under tensorflow virtual environment.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 45 (15 by maintainers)

Most upvoted comments

This is a different issue than the original post and more likely related to #4907. Please first upgrade jupyter_client (e…g, pip install jupyter_client --upgrade) which should bring jupyter_client to 5.3.4 and jupyter_core to 4.6.1. If the issue persists, please provide the relative traceback as there will be additional information provided. Thanks.

@Rishav09 I had a similar error while using tensorflow. I think the problem exists in the path which points to the python executable. I did ‘jupyter kernelspec list’ which spit out

Available kernels:
  python3    C:\Users\Manish\Miniconda3\envs\uterm1\share\jupyter\kernels\python3

Upon examining this directory closely I found kernel.json had argv with path to python executable incorrectly stated. It had

{
 "argv": [
  "C:/Users/Manish/Miniconda3/envs/uterm1/bin/python",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3",
 "language": "python"
}

There was no ‘bin’ directory but python executable was present directly inside ‘uterm1’ so i edited the path removing ‘bin’ to finally include

 "argv": [
  "C:/Users/Manish/Miniconda3/envs/uterm1/python"

in kernel.json

This solved my problem and everything worked as it used to. Conclusion: Edit the path in kernel.json to correctly point to python executable. Hope this helps !!

@BurhanAHanif - You might try taking a look at https://github.com/jupyter/notebook/issues/2301#issuecomment-287119893 and the surrounding comments/instructions.

in case it might help: @Rishav09 I had a similar issue after deleting older python version (3.6) and it seems fixed after editing (changing to 3.7) kernel.json in the folder indicated by jupyter kernelspec list

Probably your python3 kernelspec points to a Python executable that no longer exists. Try installing a kernelspec from your tensorflow environment.

@kevin-bates your a life saver sir. felt like putting my head through a wall

Please start with this comment.

Just googling pandas, I think you might want …

df1 = pandas.read_csv("supermarkets.csv")

but that’s the extent of my pandas knowledge.

@Sunny0002 - should you still have issues with your pandas code and you believe there’s a relation to notebook, please open a completely new issue since this is unrelated to this particular issue regarding kernel startup.

yup…Googled it… everything working fine at the moment…

Please start with this comment.

Thanks for help it worked for me… much appreciated!

You’re using the older modules of juypter_client and jupyter_core. Follow the steps to upgrade those modules (above) and please report back results after that upgrade and restarting your Notebook server. If failures still occur, it’s likely an issue with a mounted filesystem.