Error while running 'jupyter-lab' or 'jupyter lab' on Windows machine

As mentioned in this link about how to install Jupyterlab with pip, I ran into some problems. The installation went fine as far as my command prompt is concerned. But when I try to run Jupyterlab using the command jupyter lab the following error message shows up:

‘jupyter-lab’ is not recognized as an internal or external command,
operable program or batch file.

image

I don’t know what is happening and some help will be really appreciated.

Note: In the above link, there’s written:

If installing using pip install --user, you must add the user-level bin directory to your PATH environment variable in order to launch jupyter lab.

Is this a possible reason I am running into such an error? If so, can someone help me out as to how to add my user-level bin directory to my PATH environment variable?
I am in Windows (version 10.0.19043 N/A Build 19043) with an x64-based PC

Note: I tried to install Jupyter notebook using the guide provided in the above link (pip install notebook), it installed fine, but while trying to run the notebook using jupyter notebook, I ran into the same problem ('jupyter' is not recognized as an internal or external command, operable program or batch file.). But this post here solved this problem.

However, I could not solve the problem for JupyterLab.

Note: As mentioned by @fomightez in his comment below, I tried using the command jupyter lab but it still showed

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

First, did you try the following command to start JupyterLab?

jupyter lab

That has always been the command I’ve used and is consistent with the official JupyterLab docs on starting JupyterLab and here.

@fomightez yes, I tried to run using that command only. My bad, I wrote the command wrong here. I’m correcting it…

No, you didn’t write the command wrong. Your original image shows you tried what the page linked to says to use. However, I’m not aware of that being the command. So the inconsistency on the Jupyter page verse the JupyterLab documentation is puzzling to me even more so than things not working on Windows. However, sometimes there is more than one way to start things.

UPDATE: Given it says here either jupyter notebook or jupyter-notebook works for the classic notebook, I gather jupyter-lab may be another way. However, I’d prefer the documentation on install and start at Jupyter and JupyterLab documentation sites be consistent so that users having problems, and those trying to help them, aren’t distracted by slight variations of commands that are probably due to flux in the choices made in nascent versions.
Plus in the end it seemed helpful we had found these variants that have the dashes & that aren’t two words with spaces between them.

1 Like

@fomightez I tried using this command which you mentioned, it is still showing the same error.
I think I will edit this question showing both the methods which I’ve tried so far…

Yes, but the recent screenshot you’ve now added has a warning cut off. That warning is probably why things failed.
Plus, you should definitely add what Windows version you are doing this on.

Yes, I too had the same thought, but I don’t know how to add to the PATH…

And you say in your original post you tried, the solution here and it worked for the classic notebook.
Did you try the following variations for JupyterLab?

python -m jupyterlab
python -m lab
python -m jupyter-lab
python -m jupyter lab

The comment there by Georgy has the first one but I thought maybe another typo and so was worth trying some variations?


Did you search that issue and try any of the solutions? Such as:

2 Likes

@fomightez I tried adding python to Windows PATH, by uninstalling and reinstalling python and then manually adding the scripts path to PATH. Finally it worked.

However, the command jupyter lab throws an error:

Fatal error in launcher: Unable to create process using ‘“c:\program files\python.exe” “C:\Users\user\AppData\Roaming\Python\Python39\Scripts\jupyter.exe” lab’: The system cannot find the file specified.

However, if I run jupyter-lab, it works just fine.

Same thing happens when I try to open only the notebook(jupyter notebook) after installing jupyter notebook using pip install jupyter:

Fatal error in launcher: Unable to create process using ‘“c:\program files\python.exe” “C:\Users\user\AppData\Roaming\Python\Python39\Scripts\jupyter.exe” notebook’: The system cannot find the file specified.

But if I run jupyter-notebook, works just fine again.

Seems like there is some inconsistency in the documentations.

1 Like

Glad it’s working and your posts on what worked should help others troubleshoot installing via pip on Windows, too.

Perhaps the one with the dashes may work in Windows more reliably, while the those that are two words fail, due to the way it is handling spaces in the commands?
I’m glad we learned to try some variants. I hadn’t been aware of those and that they may work differently on different platforms since I usually use Unix-based systems.

1 Like

For manually adding the scripts path to PATH, I mainly used the information at the link How to add Python to Windows PATH - Data to Fish.

But as a fair amount of time has passed since that page has been updated (17th July 2020) things were a bit different in terms of appearance (though the process was basically the same).

I already found out that there was a Path variable under my environment variables list and proceeded to Edit the path:
image

Then I went on to add a New path in there:
image

In my systems drive, I searched for Scripts and I added the resultant path for the python Scripts folder. For my system, that came out to be:

C:\Users\user\AppData\Roaming\Python\Python39\Scripts

Saved this, restarted my command prompt, and it works just fine.

Thanks, @fomightez again for helping me out…

2 Likes

By running
python -m jupyterlab
instead of “jupyter lab” or “jupyter-lab” solves this problem.

Why does the official document fool us? We follow every instruction in the official website and waste our time.

1 Like

I love you. I would have been working at this all night if it weren’t for your comment.