59

I have tried to install jupyter lab on my Kubuntu machine. If I install jupyter lab with 'pip3 install jupyter jupyterlab' the command 'jupyter notebook' works completly fine. But if I try to run 'jupyter lab' every time I get the message:

Traceback (most recent call last):
  File "/usr/local/bin/jupyter", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 230, in main
    command = _jupyter_abspath(subcommand)
  File "/usr/local/lib/python3.6/dist-packages/jupyter_core/command.py", line 133, in _jupyter_abspath
    'Jupyter command `{}` not found.'.format(jupyter_subcommand)
Exception: Jupyter command `jupyter-lab` not found.

What is wrong?

I tried to reinstall jupyter and jupyterlab multiple times with the same issue.

Hamza
  • 5,373
  • 3
  • 28
  • 43
CacherJoe100
  • 591
  • 1
  • 4
  • 3

15 Answers15

79

Its the space. Its always the space. Never ever use spaces within package name. Its always either namepart1-namepart2 or namepart1namepart2. This is because arguments are separated by space. So if you put space in between, it makes pip think that you want to install two different packages named jupyter and lab. Just use:

python -m pip install jupyterlab

Or simply:

pip install jupyterlab

No need to uninstall or reinstall anything. However to run jupyter lab server you might want to add spaces as follows:

jupyter lab
Hamza
  • 5,373
  • 3
  • 28
  • 43
  • 4
    As usual on stackoverflow, any answer more than a year old will become obsolete so this is now incorrect except for older OSes. jupyter removed jupyter lab from its default install, so you must separately do `pip install jupyterlab`. – jbarlow Oct 22 '21 at 20:46
  • Dont understand whats obselete here? Works on Windows 11, Python 3.9 – Hamza Oct 22 '21 at 22:53
  • One important point here is to *look at the output of `pip install jupyterlab`*. Did it have any errors? I had. Perhaps some files were being used when tried to install. Login. Logout. Pip install jupyterlab again. And *volà*! – Niko Föhr Apr 25 '22 at 13:27
20

In my case, the only way to fix this was to add the following directory to the PATH in Linux:

/home/ubuntu/.local/bin
Tommy
  • 2,355
  • 1
  • 19
  • 48
nferreira78
  • 1,013
  • 4
  • 17
15

When installing jupyterlab, we may get warning like this:

Installing collected packages: jupyterlab
  WARNING: The scripts jlpm, jupyter-lab, jupyter-labextension and jupyter-labhub are installed in '/home/tln/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed jupyterlab-3.0.14

So as per this warning, scripts like jupyter-lab will be unavailable unless added to the PATH.

Use below command to add these scripts to be able to use from command line:

tln@tln-X550LD:~$ export PATH="$HOME/.local/bin:$PATH"

That's it. This worked fine for me.

TheLittleNaruto
  • 8,325
  • 4
  • 54
  • 73
10

I had the same error on Windows 10. It was with pip install jupyterlab. Then after the error I uninstalled it with pip and reinstalled with "pip install jupyterlab". Everything worked flawlessly thereafter.

In your case you're using pip3. Try it as above or see if pip3 needs an update.

Mohamed Taher Alrefaie
  • 15,698
  • 9
  • 48
  • 66
Axel
  • 126
  • 1
  • 6
4

I had same issue. I solved it running pip install jupyterlab in prompt with admin privilegies.

  • 1
    Thanks for the tip to install with admin privileges . On win 10 pip install jupyterlab command with admin privileges fixed the jupyter lab not found error – user15420598 Jan 10 '22 at 02:15
4

Had the same issue and resolved it by installing with pip3

pip3 install jupyterlab; jupyter lab

Sammi
  • 41
  • 4
1

If you face -bash: jupyter-lab: command not found or -bash: jupyter: command not found, etc., you can look for "jupyter-lab" and enter that full path instead.

Mac:

$ /Users/mark/venv/bin/jupyter-lab

Windows:

C:\mark\venv\Scripts\jupyter-lab.exe
Reveille
  • 4,359
  • 3
  • 23
  • 46
  • I have a W10 system. For some weird reason (I'm not interested in figuring out why) I've got the jupyter-lab.exe installed in a different folder. In case you don't find that executable file, look for it using the Windows File Explorer. – carloswm85 Jul 24 '20 at 17:01
  • I came back here just to tell you the best and quicker way to find the exe file. Open the command prompt and go to the C:/ drive. Type in `dir jupyter-lab.exe /s /p` This should give you the exact location of the file. – carloswm85 Jul 25 '20 at 14:19
1

I got this same error every time I forgot to activate the virtualenv jupyterlab was installed into. After activating the virtualenv, all's well.

With pip

$ source [path_to_venv]/bin/activate

With pipenv

$ pipenv shell

Then, with a prompt indicating an activated shell, you can enter your command

(venv) $ jupyter lab

With conda or other more holistic python environments, you probably use their gui to activate a virtualenv with jupyter and jupyterlab installed.

mightypile
  • 7,589
  • 3
  • 37
  • 42
1

Install with Anaconda

conda install -c conda-forge notebook
conda install -c conda-forge jupyter
conda install -c conda-forge jupyter_contrib_nbextensions
peterretief
  • 2,049
  • 1
  • 15
  • 16
1

Once installed you just have to run

pip install jupyterlab

~/.local/bin/jupyter-lab

and ready and open browser http://localhost:8888/lab

Ubuntu 22 Lubuntu 22

0

well the problem is like this:

the jupyterlab module has not been packaged for debian, but the jupyterlab_server package has, named python3-jupyterlab-server. please sudo apt install python3-jupyterlab-server.

then, as your user, run pip3 install jupyterlab, that will install it in your ~/.local/bin a few programs, the missing jupyter-lab among them.

last, but not least, run jupyter-serverextension enable --py jupyterlab.

to be able to run jupyter lab, you first need to run export PATH="/home/$(whoami)/.local/bin:"$PATH. this command will run automatically if added to your ~/.bash_profile.

alex
  • 651
  • 1
  • 9
  • 11
0

ubuntu can not find the jupyter-lab because it is not in path.

in order to check the place of installment. run below command

find ~ -name jupyter-lab

possible result: /home/soshiant/.local/bin/jupyter-lab

for adding a directory to the Linux path you can follow below link:

How to add a directory to the PATH

Ali Esmaily
  • 801
  • 6
  • 6
0

if anyone still struggling ... try:

find ~ -name jupyter-lab

and then:

export PATH=[path] 

then try again: jupyter lab note: don't add any extra spaces and PATH is case sensitive and if u still struggling just try to install any missing pkgs after hosting to the main path by opining another tab or changing the path to main. and then host to localhost:8888/lab that should works fine...

0

I was using conda to install conda install -c conda-forge jupyterlab and this error came about.

I simply used this command to get it to run. pip install jupyterlab

Ryan
  • 356
  • 1
  • 6
  • 26
  • 2
    In the short term this may fix things, but mixing and matching package managers is going to compound your issues in the related environments in the long run. – Wayne Dec 27 '22 at 20:38
  • I already enabled my conda environment here and run that pip command. Is the issue you highlighted still be a potential problem? – Ryan Dec 28 '22 at 04:42
  • I'm not following your latest comment but potentially you installed something with conda and the same thing with pip. It's just not a good idea to always do that. – Wayne Dec 29 '22 at 04:06
-2

In my ubuntu installation this was qused by not using sudo before the install.

sudo pip install jupyterlab

If you already installed jupyterlab, and it dit not work, you can install again using sudo, you dont need to remove the old version first for it to work

Mister Verleg
  • 4,053
  • 5
  • 43
  • 68