[python] Running Jupyter via command line on Windows

I have installed Jupyter on Windows 10, Python 3.x via

$ pip install jupyter

The installation works fine, even though I did restart the terminal.

But trying to run

$ jupyter notebook

gives the following error

'jupyter' is not recognized as an internal or external command, operable program or batch file.

How and where do I find the executable for Jupyter?

This question is related to python jupyter-notebook jupyter

The answer is


Problem for me was that I was running the jupyter command from the wrong directory.

Once I navigated to the path containing the script, everything worked.

Path- C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\Scripts


If you have installed jupyter with "python -m pip install jupyter" command instead of "$ pip install jupyter" command then follow these steps:

  1. Create a notepad
  2. Change its extension from ".txt" to ".ipynb"
  3. Right click it and click "open with"
  4. In the pop up, go to - C:\Users\<"windows_user_name">\AppData\Roaming\Python\Python38\Scripts
  5. Click on "jupyter-lab.exe"

Add system variable path, this path is where jupyter and other scripts are located

PATH -->

`C:\Users\<userName>\AppData\Roaming\Python\Python39\Scripts`

Like in my laptop PATH is:

"C:\Users\developer\AppData\Roaming\Python\Python39\Scripts"

After that, You will be able to run jupyter from any folder & any directory by running the below command

jupyter notebook


100% working solution:

Follow these steps:

  1. Open the folder where you downloaded "python-3.8.2-amd64.exe" setup or any other version of python package

  2. Double click on "python-3.8.2-amd64.exe'

  3. Click "Modify"

  4. You will see "Optional features"

  5. Click "next"

  6. Select "Add python to environment variables"

  7. Click "install"

  8. Then u can run jupyter in any desired folder u desire

    E.g  open "cmd" command prompt

    Type : 
    E: 

    E:\>jupyter notebook

    It will get started without showing

    'Jupyter' is not recognized

Thanks


To install I used "pip install notebook" in windows command line

To run python -m notebook did not work for me, but python3 -m notebook worked


I added

 c:\users\[user]\appdata\roaming\python\python37\site-packages

to the path and it worked.


I was facing the same issue in windows7, as i just recoverd my computer with the help of recovery point and after that notebook just stopped working. I tried to change the path setting but nothing was working so I just simply uninstalled the python with the application from which it was installed and after that I installed it again. After that I installed jupyter notebook again and then it worked fine. Thanks


You can add the following to your path

C:[Python Installation path]\Scripts

e.g. C:\Python27\Scripts

It will start working for jupyter and every other pip install you will do here on.


My problem was my user's folder had a space in folder name.

After creating a new user and switching to that windows user, windows shortcuts and links from within' Anaconda worked fine.

Windows 8.1 64 Bit. Latest Anaconda.

Note: I ended up uninstalling an reinstalling Anaconda but my sense is the problem was really just the space in the windows user username/user folder.


## windows CMD

for default install (just check "add path" and "next" when installing)

python -m notebook

for custom install in C:\

jupyter notebook

first you should make sure that you are put your python path in your system variables .. Then try run this

python -m pip install jupyter --user

and then run this

py -m notebook or  jupyter notebook

Here is how I resolved stated issue, hope it helps:

  1. install python 3.7 using official website for python, while installing include installing PATH by checking it's box

  2. after that open cmd (be sure to open it after step 1) and write: pip install jupyter ENTER

  3. now you should be able to open jupyter notebook by using command: jupyter notebook

Seems simple, but it may as well help.


Check whether you have given python PATH in environmental variables properly.
If not, then set python path. Then use:

$ python -m notebook

First run this command

pip install jupyter

then add system variable path , this path is where jupyter and other scripts are located

PATH = C:\Users<userName>\AppData\Roaming\Python\Python38\Scripts

e.g PATH=C:\Users\HP\AppData\Roaming\Python\Python38\Scripts

After that we can run jupyter from any folder/directory

jupyter notebook


In windows 10: If you used anaconda3 for Jupyter notebook installation and forgot to check the box to add the environment variables to the system during installation, you need to add the following environment variables to the "Path" variable manually: (search windows settings for Edit environment variables")

Environment variables for Anaconda3


If you are using the Anaconda distribution, make sure when installing it that you check the "Change PATH" option.


In Windows 10 you can use ipython notebook. It works for me.


Using python 3.6.3. Here after installing Jupyter through command 'python -m pip install jupyter', 'jupyter notebook' command didn't work for me using windows command prompt.

But, finally 'python -m notebook' did work and made jupyter notebook to run on local.

http://localhost:8888/tree


I got Jupyter notebook running in Windows 10. I found the easiest way to accomplish this task without relying upon a distro like Anaconda was to use Cygwin.

In Cygwin install python2, python2-devel, python2-numpy, python2-pip, tcl, tcl-devel, (I have included a image below of all packages I installed) and any other python packages you want that are available. This is by far the easiest option.

Then run this command to just install jupyter notebook:

python -m pip install jupyter

Below is the actual commands I ran to add more libraries just in case others need this list too:

python -m pip install scipy

python -m pip install scikit-learn

python -m pip install sklearn

python -m pip install pandas

python -m pip install matplotlib

python -m pip install jupyter

If any of the above commands fail do not worry the solution is pretty simple most of the time. What you do is look at the build failure for whatever missing package / library.

Say it is showing a missing pyzmq then close Cygwin, re-open the installer, get to the package list screen, show "full" for all, then search for the name like zmq and install those libraries and re-try the above commands.

Using this approach it was fairly simple to eventually work through all the missing dependencies successfully.

Cygwin package list

Once everything is installed then run in Cygwin goto the folder you want to be the "root" for the notebook ui tree and type:

jupyter notebook

This will start up the notebook and show some output like below:

$ jupyter notebook
[I 19:05:30.459 NotebookApp] Serving notebooks from local directory: 
[I 19:05:30.459 NotebookApp] 0 active kernels
[I 19:05:30.459 NotebookApp] The Jupyter Notebook is running at: 
[I 19:05:30.459 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Copy/paste this URL into your browser when you connect for the first time, to login with a token:

http://localhost:8888/?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I had the same problem, but

py -m notebook

worked for me.


you can create a batch file and search for Jupiter in your windows search and ooen its properties and you will get this string. D:\anaconda3\python.exe D:\anaconda3\cwp.py D:\anaconda3 D:\anaconda3\python.exe D:\anaconda3\Scripts\jupyter-notebook-script.py "%USERPROFILE%/" after getting this you can create a jupitor.bat file with this content it that and you can save that file in a script folder in d or any drive and add the path of your script file in your environmental path

and then you can easly call this by typing jupitor in cmd.


I have two python version installed: 1. Python 3.8.2: This was installed independently 2. Python 3.7.6: This was installed along with Anaconda 3

Multiple versions caused conflict even after setting the path variables correctly.

I have uninstalled the Python 3.8.2 and after restart, the command

jupyter notebook

Worked perfectly :)


In Python 3.7.6 for Windows 10. After installation, I use these commands.

1. pip install notebook
2. python -m notebook

OR

C:\Users\Hamza\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.7_qbz5n2kfra8p0\LocalCache\local-packages\Python37\Scripts .

For my pc python-scripts are located in the above path. You can add this path in environment variables. Then run command.

1. jupyter notebook

Please try either of these commands first;

$ py -m notebook
$ python -m notebook

for jupyterlab users

py -m jupyterlab

Otherwise

$ python -m pip install jupyter --user
$ jupyter notebook

If this does not work.

pip does not add jupyter directly to path for local.

The output from

$ which python
/c/Users/<username>/AppData/Local/Programs/Python/Python35-32/python

After some digging I found a executable for jupyter in the folder:

C:\Users\<username>\AppData\Roaming\Python\Python35\Scripts\jupyter.exe

Difference between local and roaming folder

So if you want to be able to execute a program via command line, you need to add it into the %PATH variable. Here is a powershell script to do it. BE SURE TO ADD THE ";" before adding the new path.

$ [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Users\<username>\AppData\Roaming\Python\Python35\Scripts", [EnvironmentVariableTarget]::User)

Update:

if you are using python3, switch out python with python3 but I encourage you to use pyenv instead :)


I just installed JupyterLab on top of my Python 3.8/pip enabled Win10 machine, so I ran into these startup problem with windows. If everything is ok (check that you have PATH for Python, eg. C:\Users[Username]\AppData\Local\Programs\Python\Python38-32\Scripts) you simply run:

jupyter-lab.exe

and that's it.

Cheers


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to jupyter-notebook

How to prevent Google Colab from disconnecting? Jupyter Notebook not saving: '_xsrf' argument missing from post How do I install Python packages in Google's Colab? What is the difference between Jupyter Notebook and JupyterLab? Importing .py files in Google Colab Display all dataframe columns in a Jupyter Python Notebook How to open local file on Jupyter? how to open Jupyter notebook in chrome on windows Change the Theme in Jupyter Notebook? Jupyter notebook not running code. Stuck on In [*]

Examples related to jupyter

How to increase image size of pandas.DataFrame.plot in jupyter notebook? What is the difference between Jupyter Notebook and JupyterLab? Removing Conda environment How to open local file on Jupyter? Jupyter notebook not running code. Stuck on In [*] Can I run Keras model on gpu? IOPub data rate exceeded in Jupyter notebook (when viewing image) How to execute a * .PY file from a * .IPYNB file on the Jupyter notebook? how to make a new line in a jupyter markdown cell Running Jupyter via command line on Windows