2

I installed Jupyter Notebook using pip install notebook but I am not able to run it.

When I try runing using jupyter notebook, it gives me the CommandNotFoundException: Error when running 'jupyter notebook'

and

When I try runing using python -m notebook, it gives me the ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython': Error when running 'python -m notebook'

I have added the following into PATH:

  1. Path to python.exe present inside local folder.
  2. Path to scripts folder present inside local folder.
  3. Path to scripts folder present inside roaming folder.


All the jupyter dependencies(jupyter.exe, jupyter-core.exe, etc) are present in scripts folder inside 'Roaming' folder and not inside 'local' folder.

enter image description here

python version: 3.8.4
pip version: 20.1.1

Roshin Raphel
  • 2,612
  • 4
  • 22
  • 40
  • 1
    Any problems with packages? What is `python -m pip check` giving you? Any missing deps? – Dawid Gacek Jul 29 '20 at 10:03
  • you should install anaconda first, then you will automatically get jupyter notebook – Divyessh Jul 29 '20 at 10:04
  • Could you please post the output of `pip freeze`? or Can you make sure `jupyter` package is in the list? – Ahmet Jul 29 '20 at 10:56
  • @AhmetTavli I see `jupyterlab==2.2.1` , `jupyterlab-server==1.2.0` and `notebook==6.0.3` in output of `pip freeze` [pip freeze output](https://i.imgur.com/pTnaOAl.png) – Syed Afsahul Haque Jul 29 '20 at 17:26
  • @DawidGacek thanks! that worked. I got the list of missing dependencies with I installed and it worked! Can you add that as an answer so that I can accept it to help other users? – Syed Afsahul Haque Jul 29 '20 at 17:40

4 Answers4

2

Use: python3 -m notebook in the terminal.

Benjamin Zach
  • 1,452
  • 2
  • 18
  • 38
pratsy
  • 459
  • 5
  • 4
1

I had worked with Jupyter Notebook and usually the cause for most of the cases is missing dependecy - Jupyter got a lot of them.

Please check if they are not missing by running:

python -m pip check

or

pip check

This will give you list of missed (sometimes there are versions problems) dependencies. Installing proper version with pip install <dep>==<version> should help.

Dawid Gacek
  • 544
  • 3
  • 19
0

Edited: @Divyessh Maheshwari, if you have installed anaconda, then make sure you are running jupyter notebook in the anaconda prompt.

If you haven't and you don't want to install anaconda, you might need to downgrade Python according to this answer Is there a way to run Jupyter Notebooks Without Anaconda?

James Li
  • 1
  • 2
0

It worked to me using: python3 -m notebook in terminal, then: To access the notebook, open this file in a browser: file:///C:/Users/Sorin/AppData/Roaming/jupyter/runtime/nbserver-6104-open.html Or copy and paste one of these URLs: http://localhost:8888/?token=13028604333fbe9766eb5c0f2668378a05d0712ef08891a7 or http://127.0.0.1:8888/?token=13028604333fbe9766eb5c0f2668378a05d0712ef08891a7

Sorin
  • 1
  • Welcome to stackoverflow! In the question, it seems like the poster already tried `python -m notebook` as suggested by pratsy's answer and got `ImportError: cannot import name 'constants' from partially initialized module 'zmq.backend.cython'`. – Kaia Feb 28 '23 at 22:52
  • (Also, those tokens won't work on somebody else's computer, and while it won't matter for a local jupyter instance, definitely be careful posting auth tokens on the public internet!) – Kaia Feb 28 '23 at 22:52
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33916262) – Ran A Mar 01 '23 at 16:27