45

I installed jupyter using pip on my macbook air. Upon trying to execute the command jupyter notebook, I get an error

jupyter: 'notebook' is not a Jupyter command

I used the --h option to get a listing of all jupyter commands and indeed, 'notebook' is not one of the commands. I am running python 2.7 and it was already installed before I installed jupyter.

I searched on google and I see a similar problem some people have faced with the latest version of jupyter but I don't see any solutions. Can somebody point me in the right direction?

which -a pip: /usr/local/bin/pip

which -a jupyter: /usr/local/bin/jupyter

Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
pokiman
  • 956
  • 2
  • 12
  • 20
  • `I installed jupyter using pip on my macbook air.` - please show us how you installed `jupyter`- Did you install `notebook` as well? – cel Jan 27 '16 at 05:36
  • I am guessing notebook was installed along with jupyter. I double checked by trying to install notebook via pip (pip install notebook) and I get the error message that notebook is already installed. For installing jupyter by executing 'pip install jupyter' – pokiman Jan 27 '16 at 05:47
  • Can you [edit] your question and add the output of `which -a pip` and `which -a jupyter`? – cel Jan 27 '16 at 05:48
  • What about `pip list` and `which jupyter-notebook`? – minrk Jan 29 '16 at 07:28
  • Please check your Jupyter version. I had a similar problem with a Jupyter version < 4.0.6. The `notebook` subcommand was not available. Instead the notebook server was launched by only running `jupyter` without a subcommand. – MaxPowers Jan 29 '16 at 10:20

11 Answers11

61

I had the same problem. After looking to a gazillion of pages on line and trying as many solutions, this is the only thing that worked for me:

pip uninstall notebook
pip install --upgrade notebook

I am not sure that the "upgrade" is necessary, but after that I had

jupyter-notebook

and

jupyter notebook

as commands.

Hüseyin BABAL
  • 15,400
  • 4
  • 51
  • 73
mic
  • 927
  • 8
  • 17
  • 10
    I didn't uninstall only upgrade and that resolved the problem for me. `pip install --upgrade notebook` – davidheller Jun 28 '16 at 13:57
  • I experience this issue on Ubuntu 16.10 also and running through the upgrade process also resolved my issue. I think this may have been because I recently updated some global Python packages and also performed some Ubuntu updates since the last time I used my notebooks – AgnosticDev Sep 10 '16 at 19:37
  • 3
    that didnt work for me, still getting the same issue – dark_ruby Jan 21 '17 at 20:32
  • I had to install Python3.6 and re run all pip commands, then it all worked – dark_ruby Jan 21 '17 at 20:41
  • After reinstalling python from brew using`brew install python`, then `jupyter notebook` solved my problem. Worked like a charm. Brew to the rescue. – Debashis Jan 11 '22 at 15:17
26

If you have installed notebook and the path is not set.

Use: python3 -m notebook in the terminal.

pratsy
  • 459
  • 5
  • 4
7

I got the same error as you when which jupyter is /usr/local/bin/jupyter. I managed to solve the case by updating/upgrading all my ipython packages

sudo -H pip install --upgrade "ipython[all]"

I managed to solve the case in OS X El-Capitan 10.11.5 and Ubuntu Linux 16.04. My Jupyter version after the upgrade is 4.1.0. My Python is 2.7.11+. My Pip version is 8.1.2.

Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
6

Try to find out the folder to which the binaries were installed using this command from the home folder:

find . -name "jupyter"

If you find any binary, execute it from that path directly or set that path to $PATH.

cprakashagr
  • 751
  • 11
  • 28
6

Uninstalling python3 and jupyter and installing them using HomeBrew worked for me.

pip3 uninstall python3
pip3 uninstall jupyter
brew install python3
brew install jupyter
which jupyter
jupyter notebook

Worked for me on macOS Catalina

Jay Patel
  • 61
  • 1
  • 1
5

I find one solution which solved this problem on my Mac

sudo rm -rf /Library/Frameworks/Python.framework
rm /usr/local/bin/python3*
brew uninstall python3
brew install python3
which python3
sudo python3 -m pip install --upgrade pip
sudo python3 -m pip install jupyter
which jupyter
jupyter notebook
Zero
  • 1,142
  • 13
  • 10
3

Seems like Apple wants things out of the "Systems" folder as much as possible. This is so you can keep viruses local to your "user", rather than your entire computer.

So if you have a "user" installed Python and Jupyter, then you will need to just make sure they're found before you try running it.

If you have that problem, and this folder exists ~/Library/Python/2.7/bin then do below:

  1. Add your user to your path $ echo 'export PATH="$HOME/Library/Python/2.7/bin:${PATH}"' >> ~/.bash_profile

  2. Reload your Bash profile $ . ~/.bash_profile

  3. Install Jupiter with user permissions $ python -m pip install jupyter --user

Mr. Demetrius Michael
  • 2,326
  • 5
  • 28
  • 40
1

I was getting error while installing jupyter on MacOS Sierra. Was struggling to install jupyter and later found the cause so sharing here.

The exceptions were like below -

Exception:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 778, in install
    requirement.uninstall(auto_confirm=True)
  File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 754, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "/Library/Python/2.7/site-packages/pip/req/req_uninstall.py", line 115, in remove
    renames(path, new_path)
  File "/Library/Python/2.7/site-packages/pip/utils/__init__.py", line 267, in renames
    shutil.move(old, new)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 299, in move
    copytree(src, real_dst, symlinks=True)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree
    raise Error, errors
Error: [('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/easter.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/parser.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/relativedelta.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/rrule.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tz.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/tzwin.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.py', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.py', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.py'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.pyc', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.pyc', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/__init__.pyc'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/zoneinfo-2010g.tar.gz', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/zoneinfo-2010g.tar.gz', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo/zoneinfo-2010g.tar.gz'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil/zoneinfo'"), ('/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil', '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil', "[Errno 1] Operation not permitted: '/tmp/pip-tchevt-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/dateutil'")]

I found this issue in MacOS Sierra and El-Capitan and fixed this by ignoring six.

pip install --upgrade notebook --ignore-installed six

Ref - https://github.com/pypa/pip/issues/3165

0

use: sudo pip install notebook in terminal.

Racil Hilan
  • 24,690
  • 13
  • 50
  • 55
Danny Shau
  • 25
  • 1
  • 2
    sudo pip introduces security risks that should at least be warned against - https://askubuntu.com/questions/802544/is-sudo-pip-install-still-a-broken-practice. Usually there is a better way than 'nuking' with sudo – SRDC Apr 15 '17 at 16:45
0

I tried everything and at the end this worked for me

sudo apt install python3-notebook jupyter jupyter-core
0

Check if jupyter is added to the PATH echo $PATH

If not, find the location of installation of jupyter.

find . name "jupyter"

Once you have the installation path, add the same to path

export PATH=$PATH:<jupyter path>

This will set the path for the current session.

To set permanently, add the following line to .zprofile

export PATH=$PATH:<jupyter path>

or you can also add the jupyter path to the PATH variable in .zshrc

Gaurav
  • 1