Bash: jupyter-lab: command not found

Summary

I’m new to this forum, new to getting on board with jupyter lab and a complete noob. You’ve been warned. I hope it is worthwhile for me to share the trouble shooting steps I took to solve an issue I was having in getting JupyterLab running. The problem I needed to sort out was why I couldn’t get Jupiter Lab running on my MacBook Pro running macOS Monterey Version 12.3.1 . This was especially perplexing since I had used the same steps with success on a different older Mac running El Capitan where the installation worked fine.

Installation Steps

This how I installed Jupyter Lab on both macs:
First I downloaded and installed pip

~$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
~$ python3 get-pip.py

I then installed jupyterlab:

~$ pip3 install jupyterlab

Trouble

I then tried to invoke jupyter lab:

~$ jupyter-lab

I got the following message:

<-bash: jupyter-lab: command not found>

Testing

Next I checked my /etc/paths file and it contains the following paths:

/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

I confirmed that both pip3 and python3 were located in /usr/bin.
Next I checked the installed packages with $ pip3 list and it shows the jupyter packages that have been installed:

jupyter-client       7.3.0
jupyter-core         4.10.0
jupyter-server       1.17.0
jupyterlab           3.4.0
jupyterlab-pygments  0.2.2
jupyterlab-server    2.13.0

Convinced that the installation was probably okay I went looking for the jupyter-lab command.

$ sudo find / -name *jupyter*

I found the jupyter-lab shell script is located at:

/Library/Frameworks/Python.framework/Versions/3.7/bin 

This was interesting, because in my El Capitan installation the jupyter-lab shell script is located in a different directory. A location that would require no change to the paths file.

/usr/local/bin/

Fix and Conclusion

The fix was to simply add the path /Library/Frameworks/Python.framework/Versions/3.7/bin to the paths file. The conclusion is that the installation process may not put the jupyter-lab shell script in the same place depending on what version of mac OS you are using. This means finding that shell script and updating the paths file accordingly. I would be interested to hear anyone else’s experience. Also, I intend to try a Linux installation.

Kind regards, glydeck

I’m not sure this is in any way involved for your case; however, I’m posting this more here as a guide for others trying to troubleshoot that may end up here since you have the invoking line listed. …
Minor part of the issue is the invoking syntax is even listed differently in a few places and sometimes you need to try a few, as touched on in this thread.
Presently, jupyter org install page lists “Once installed, launch JupyterLab with”:

jupyter-lab

Presently, the documentation for JupyterLab itself says. “Start JupyterLab using:”

jupyter lab:

I ended up listing the variations I came across here. I suspect there was some working out which is the best command that is consistent with others, with different preferences coming up here and there.


Hopefully someone else with more insight can explain what you are seeing with those two different systems. My quick guess would be that Apple often moves things around between system versions. This post by Matthias Fripp touches on a lot of this for El Capitan.


Specifically, in your case, you don’t say if these are both fresh systems or not? Could it be one or both also had some aspects of Jupyter installed on them before you tried?


I just tend to use Anaconda to install a Python distribution on remote Linux machines that I use. I would probably also try that on a Mac if I were looking to use Python & JupyterLab for serious development on a local machine, see here. Letting Homebrew handle things is a good route on Macs.

1 Like

Wayne,

Thanks for the reply. Yes, I noticed the discrepancy in the documentation. jupyter-lab vs. jupyter lab. After fixing my /etc/paths and after reading your response I now find jupyter lab will also start the server from a command prompt.

Looking at the variations you listed I thought I would test them using python3:

Command Result Comment
python3 -m jupyterlab Worked Shows as a module with pip3
python3 -m lab Did Not Work Not a module or shell script
python3 -m jupyter-lab Did Not Work Works at the command prompt
python3 -m jupyter lab Worked Also works at the command prompt

This was consistent with both machines.

I agree, and I will just chalk it up to life with Apple.

Both machines were unsullied with any Jupyter stuff.

Yes, I like homebrew but it looks like it might be depreciated with python 3.12. I got this message when I installed modules with pip3. I will look into Anaconda. That said, there is nothing serious here. I’m just trying to learn Python.

DEPRECATION: Configuring installation scheme with distutils config files is 
deprecated and will no longer work in the near future. If you are using a Homebrew 
or Linuxbrew Python, please see discussion at 
https://github.com/Homebrew/homebrew-core/issues/76621

Your comments and suggestions we’re very helpful. Thank you.
glydeck

1 Like

Hey @glydeck big thanks! Worked like a charm.