Python Running jupyter on windows

How to run Jupyter Notebook on Windows from command line – Python ?

This tutorial guides you on how to run Jupyter Notebook on Windows from command line. I have installed Python 3.x on Windows 10 and tried to run jupyter notebook from Windows command line. But it failed with the following error : No module named notebook.

> python -m notebook
C:\Users990\AppData\Local\Programs\Python\Python38-32\python.exe: No module named notebook

Run Jupyter Notebook on Windows from command line

From the above error it is evident that jupyter is not installed on your windows machine.

Therefore, first you need to install Jupyter on Windows 10 using the following pip install command.

> pip install jupyter
Collecting jupyter
  Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)
Collecting notebook
  Downloading notebook-6.3.0-py3-none-any.whl (9.5 MB)
     |████████████████████████████████| 9.5 MB 547 kB/s
Collecting jupyter-console
  Downloading jupyter_console-6.4.0-py3-none-any.whl (22 kB)
Collecting qtconsole
  Downloading qtconsole-5.0.3-py3-none-any.whl (119 kB)
     |████████████████████████████████| 119 kB 467 kB/s
Collecting ipykernel
  Downloading ipykernel-5.5.3-py3-none-any.whl (120 kB)
     |████████████████████████████████| 120 kB 1.7 MB/s
Collecting ipywidgets
  Downloading ipywidgets-7.6.3-py2.py3-none-any.whl (121 kB)
     |████████████████████████████████| 121 kB 1.3 MB/s
Collecting nbconvert
  Downloading nbconvert-6.0.7-py3-none-any.whl (552 kB)
     |████████████████████████████████| 552 kB 159 kB/s
Collecting prometheus-client
  Downloading prometheus_client-0.10.1-py2.py3-none-any.whl (55 kB)
-----------
----------
--------
Using legacy setup.py install for pandocfilters, since package 'wheel' is not installed.
Using legacy setup.py install for pywinpty, since package 'wheel' is not installed.
Using legacy setup.py install for pyrsistent, since package 'wheel' is not installed.
Installing collected packages: prometheus-client, ipython-genutils, traitlets, pywin32, jupyter-core, pywinpty, tornado, terminado, Send2Trash, mistune, pygments, jupyterlab-pygments, entrypoints, MarkupSafe, jinja2, testpath, pyparsing, packaging, six, webencodings, bleach, defusedxml, async-generator, pyzmq, python-dateutil, jupyter-client, attrs, pyrsistent, jsonschema, nbformat, nest-asyncio, nbclient, pandocfilters, nbconvert, pycparser, cffi, argon2-cffi, parso, jedi, wcwidth, prompt-toolkit, pickleshare, colorama, decorator, backcall, ipython, ipykernel, notebook, jupyter-console, qtpy, qtconsole, widgetsnbextension, jupyterlab-widgets, ipywidgets, jupyter
    Running setup.py install for pywinpty ... done
    Running setup.py install for pyrsistent ... done
    Running setup.py install for pandocfilters ... done
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 argon2-cffi-20.1.0 async-generator-1.10 attrs-20.3.0 backcall-0.2.0 bleach-3.3.0 cffi-1.14.5 colorama-0.4.4 decorator-5.0.7 defusedxml-0.7.1 entrypoints-0.3 ipykernel-5.5.3 ipython-7.22.0 ipython-genutils-0.2.0 ipywidgets-7.6.3 jedi-0.18.0 jinja2-2.11.3 jsonschema-3.2.0 jupyter-1.0.0 jupyter-client-6.1.12 jupyter-console-6.4.0 jupyter-core-4.7.1 jupyterlab-pygments-0.1.2 jupyterlab-widgets-1.0.0 mistune-0.8.4 nbclient-0.5.3 nbconvert-6.0.7 nbformat-5.1.3 nest-asyncio-1.5.1 notebook-6.3.0 packaging-20.9 pandocfilters-1.4.3 parso-0.8.2 pickleshare-0.7.5 prometheus-client-0.10.1 prompt-toolkit-3.0.18 pycparser-2.20 pygments-2.8.1 pyparsing-2.4.7 pyrsistent-0.17.3 python-dateutil-2.8.1 pywin32-300 pywinpty-0.5.7 pyzmq-22.0.3 qtconsole-5.0.3 qtpy-1.9.0 six-1.15.0 terminado-0.9.4 testpath-0.4.4 tornado-6.1 traitlets-5.0.5 wcwidth-0.2.5 webencodings-0.5.1 widgetsnbextension-3.5.1
WARNING: You are using pip version 20.1.1; however, version 21.0.1 is available.
You should consider upgrading via the 'c:\users990\appdata\local\programs\python\python38-32\python.exe -m pip install --upgrade pip' command.

Congratulations! you had installed Jupyter Notebook on Windows 10. To run the Jupyter Notebook, run the following command at the Command Prompt.

> python -m notebook

[I 12:10:56.381 NotebookApp] Writing notebook server cookie secret to C:\Users990\AppData\Roaming\jupyter\runtime\notebook_cookie_secret
[W 12:10:57.016 NotebookApp] Terminals not available (error was No module named 'winpty.cywinpty')
[I 12:10:57.016 NotebookApp] Serving notebooks from local directory: C:\Users990\Documents\sneppets\Workspaces\Python\Examples
[I 12:10:57.017 NotebookApp] Jupyter Notebook 6.3.0 is running at:
[I 12:10:57.017 NotebookApp] http://localhost:8888/?token=2ad96578b2fddf1825107039bae731e076d7d8620967bfc3
[I 12:10:57.017 NotebookApp]  or http://127.0.0.1:8888/?token=2ad96578b2fddf1825107039bae731e076d7d8620967bfc3
[I 12:10:57.017 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 12:10:57.070 NotebookApp]

    To access the notebook, open this file in a browser:
        file:///C:/Users/91990/AppData/Roaming/jupyter/runtime/nbserver-13252-open.html
    Or copy and paste one of these URLs:
        http://localhost:8888/?token=2ad96578b2fddf1825107039bae731e076d7d8620967bfc3
     or http://127.0.0.1:8888/?token=2ad96578b2fddf1825107039bae731e076d7d8620967bfc3

Notebook server has been started from the command line. You should see notebook open in a browser as shown below. Note, it will open your default web browser to that URL as shown below.

Python Running jupyter on windowsAfter notebook opens in the default browser, you will see the Notebook Dashboard which will show list of notebooks, files and other subdirectories in the directory where the notebook server has started. Please note, I have only hello.py in the Jypyter folder path from where I started notebook server. Therefore you only see hello.py file.

That’s it. You had learnt how to install jupyter notebook on Windows 10. Also, learnt how to run jupyter notebook on Windows from command line.

Hope it helped 🙂

You’ll also like:

References

 

guest
0 Comments
Inline Feedbacks
View all comments