Jupyter notebook not installing

Hi there,

I am doing the “analyzing financial data with Python” course and I am trying to install jupyter notebook.

I have windows, python 3.9, git bash and pip. I type “$ pip install jupyter” in git bash and it seems to download (there are a lot of white lines appearing). But then when I type “$ jupyter notebook” it says “bash: jupyter: command not found”.

Can someone please help with this. I have looked on google, youtube, forums etc and I can’t find an answer. I am very new to programming to so my knowledge is very limited.

How do I install jupyter notebook and how can I start using it?

It seems odd that you can run a site-package like pip but not jupyter. This is a bit of a guess but it sounds like you may potentially have a messy PATH with more than one version of python included or something a little odd (pip is not installing where you expect).

You can treat PATH a bit like a python import statement of the form from bin import *; from usr/bin import * etc. etc. but if you have name collisions or the references are wrong then things can behave very unexpectedly.

If the PATH is confused then unfortunately it’d be up to you to fix it as it’d be somewhat unique to you and your device. A bit of time looking into is worthwhile as Python’s packages are rather confusing anyway if you know nothing about the command line.

For a bit of digging-
You should be able to see where packges are installed with-
pip --verbose list

Does Python itself run? python -V
Is there a difference between the output of pip -v list and python -m pip -v list?

I can’t recall what commands gitbash has on the fly but something like-
which --all pip
might help as it finds all executables on the PATH (where, whereis and various similar tools exist but they may not be included).

1 Like

Hi @tgrtim, thanks for your quick reply.

The whole path stuff is a bit over my head. I did take the command line course, but it didn’t go into detail about the path stuff. This is what it says when I run the “$ echo $PATH” command:

I have installed several different versions of python before, so that might be my problem. Should I uninstall everything, and reinstall?

And I ran the “$ pip --verbose list” command and this is the part of the list that came up (the whole list is too big to snip):

And Python does run. I have version 3.9.6

And lastly, the “pip -v list” and “python -m pip -v list” are different. They start out the same, but then the latter one has massive amount of text at the end.

Not sure if any of this helps you. As you can tell I’m a newbie.

Like I say, any issues with your PATH are up to you to fix since it will be unique to your device (assuming there any issues, I’m less familiar with the pure python windows install). I highly suggest learning at least something about it now because python’s dependency management only ever gets more confusing :sweat_smile:.

It seems like some of your site-packages aren’t included on your PATH which may even be intentional (seems like the ones from local are, the ones from roaming are not). If python -m pip list and pip list list the same packages then perhaps you could simply use-

python -m jupyter notebook

A better option would be to start working with virtual environments that at least attempt to partially isolate site packages (this is generally much easier and less error prone than adding everything to the same directory even for a single user). Something like the following would be a worthwhile read-

“the python -m jupyter notebook” command actually worked! But why is that? I am so confused now.

You say I should learn about PATH; is there a specific place I can go to learn about that?

And when you say installing packages, do you mean for example Miniconda?

As you can tell I’m very new to this, so even the most basic stuff is confusing to me. It’s a bit disappointing that the course I’ve taken doesn’t cover this.

Would it perhaps be easier to uninstall and reinstall python, and then download miniconda?

Fortunately I’ve been on Windows today so I’ve had a little look into it. The following is my rather lengthy interpretation thought I can’t promise it’s 100% correct.

For Python site-packages\ is the standard location for the installs of third party modules/packages (this is where things like numpy and jupyter are added).

In this instance you have two different sets of site-packages, “system” and “user” site-packages.

When you first installed Python it likely would’ve included a few basic things in the “system” site-packages (intsalls of pip and setuptools etc.). By using pip install package you install new packages to your “system” site-packages (for you it seems to be something like C:\\Users\\username\\AppData\\Local\\Python\\Python39\\site-packages).

The process of installation sometimes adds scripts to the neighbouring Scripts\ directory (there would be different Scripts\ directories for “user” and “system” site-packages). Not every module adds such scripts but certain packages such as pip and jupyter notebook do. In this instance your PATH variable probably contains something like C:\\Users\\username\\AppData\\Local\\Python\\Python39\\Scripts as one of the entries (this is the “system” site-packages path for you). If you had a look in this directory you’d find stuff like pip.exe and similar.

By having this directory on your PATH you can run certain scripts it contains like pip without using the full path to run it e.g. pip instead of the full C:\\Users\username\AppData\Local\Python\Python39\Scripts\pip.exe.

This next bit may not be entirely accurate. I try to avoid user site-packages for the most part and work in isolated environments or containers so I only tested this quickly.

If I’m not mistaken there would be a second site-packages designed for individual users located somewhere in ...\AppData\Roaming\. Installing packages here normally requires the --user flag when using pip (or a fallback if certain admin controls prevent alteration of “system” site-packages). So pip install --user numpy for example. This set of site packages does not appear to be on your PATH by default (which might be intentional). So you cannot simply use items from the \Scripts directory of your “user” site-packages like you can from the “system” site-packages.

Your python command is already on your PATH in this case so you can use it directly. It (python) has its own path for finding python packages. You can see what it tries to read from with python -m site.

If you run that command you’ll likely see sys.path includes what we called the “system” site-packages AND at the very end there will be some additional flags mentioning USER-SITE with a path and whether or not it is being used (it is probably set to True). If it is set to True (and has the correct path) then python can find and use your “user” site-packages.

When you use python -m name it attempts to run a module as a script which in this case is exactly what we want. So we can run jupyer notebook as a script via Python, python -m jupyter notebook skipping PATH entirely (except to run python itself here :slight_smile:).

Conda might be a little nicer but it’s not overly different. It provides a lot of things at once and is probably a little easier to get started with (it does its best to stay off your PATH variable and only initlialises itself in certian interactive terminals). You might have an easier time with it; long-term you’d still want to use virtual evnironments regardless.

Hi @tgrtim,

Thanks again for your help, and apologies for the delay in the response. I really had to digest what you were saying, and trying to figure it out.

It is true what you say about the “system” site packages being in the location you mentioned:

And you are also right about the scripts location:

And you are also correct about the site packages in the roaming location:

But I’m still confused about what this all means. It just seems like there are different versions of the same programs in different directories. When you say that a “set of site packages does not appear to be on your path”, what does that actually mean? How can I change a path? I thought a path just showed which directories your programs were in.

But the good news is that the “python -m jupyter notebook” command at least works, so that I can open jupyter.

All this changing of path, and not finding the right path etc. was not in the “learn the command line” course, so I’m quite lost.


Sorry, when I say PATH the capitalisation is intentional. It differs from a standard path to a file. One of your screenshots you included shows your current PATH (a series of absolute directory paths separated by : characters).

There’s a bit too much to try and cover in a text reply but it grants you the option to run certain scripts and programs by name instead of using the full filepath.

For example, I could run one of my python installs by providing the full filepath to an executable python binary on my system to cmd-

# usage is a bit clunky though-
C:\PythonInstalls\Python3.9.5\python.exe -m pip install jupyter notebook

But, because I have C:\PythonInstalls\Python3.9.5\ on my PATH at the moment I can run that executable binary with just- python

python -m pip install jupyter notebook

So we’re using it as a bit of a convenience tool here.

As mentioned before some of your directories for installed Python packages are on your PATH, and some aren’t. The command line course is a bit basic and Python’s package management is a pain so I’d highly suggest taking a bit of time to read up on it as wrapping your head around it now might save you some headaches in the future.

Rather than fiddling with your PATH at this point it might be easier to work with virtual environments (yes, there’s more reading :grin:) that would typically alter your PATH for you, but only when activated. In this was you can somewhat isolate your installs and include only the packages you need for a particular project/task.

If you’re working with pure python then the following might be useful-

For conda see-

Thanks again Tim,

I’ll read up on all this stuff, and I’ll also ask a programmer friend of mine to explain it to me :slightly_smiling_face:

Seems like all this stuff is basic knowledge I need to be able to progress further.