pokiman
pokiman

Reputation: 986

Jupyter notebook command does not work on Mac

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

Upvotes: 46

Views: 102874

Answers (12)

Ankit Chand
Ankit Chand

Reputation: 11

Upgrading it worked for me

pip install --upgrade notebook

Upvotes: 0

Gaurav
Gaurav

Reputation: 1

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

Upvotes: 0

Vineet Kumar Gupta
Vineet Kumar Gupta

Reputation: 535

I tried everything and at the end this worked for me

sudo apt install python3-notebook jupyter jupyter-core

Upvotes: -1

pratsy
pratsy

Reputation: 599

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

Use: python3 -m notebook in the terminal.

Upvotes: 36

Jay Patel
Jay Patel

Reputation: 61

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

Upvotes: 6

Mr. Demetrius Michael
Mr. Demetrius Michael

Reputation: 2406

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

Upvotes: 4

Zero
Zero

Reputation: 1152

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

Upvotes: 5

deepakpanth
deepakpanth

Reputation: 11

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

Upvotes: 1

Danny Shau
Danny Shau

Reputation: 25

use: sudo pip install notebook in terminal.

Upvotes: 0

cprakashagr
cprakashagr

Reputation: 761

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.

Upvotes: 6

mic
mic

Reputation: 953

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.

Upvotes: 64

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.

Upvotes: 9

Related Questions