helloB helloB - 25 days ago 7
Python Question

Jupyter install fails on Mac

I'm trying to install Jupyter on my Mac (OS X El Capitan) and I'm getting an error in response to:

sudo pip install -U jupyter


At first the download/install starts fine, but then I run into this:

Installing collected packages: six, singledispatch, certifi, backports-abc, tornado, jupyter-core, pyzmq, jupyter-client, functools32, jsonschema, nbformat, pygments, mistune, MarkupSafe, jinja2, nbconvert, path.py, pickleshare, simplegeneric, setuptools, gnureadline, appnope, ptyprocess, pexpect, ipython, ipykernel, terminado, notebook, ipywidgets, jupyter-console, qtconsole, jupyter
Found existing installation: six 1.4.1
DEPRECATION: Uninstalling a distutils installed project (six) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling six-1.4.1:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/Library/Python/2.7/site-packages/pip/req/req_set.py", line 726, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip/req/req_install.py", line 746, 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 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
copy2(src, real_dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 131, in copy2
copystat(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 103, in copystat
os.chflags(dst, st.st_flags)
OSError: [Errno 1] Operation not permitted: '/tmp/pip-ByX5xW-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'


What can I do to fix this?

Ivo Ivo
Answer

The default OS X Python that El Capitan ships with is unfortunately rather badly mispackaged (grrr, Apple). Not only have they shipped some rather strange 3rd party packages already installed, but strange (old) and beta versions of those packages. Furthermore, they are heavily system protected.

This makes the default python rather unfriendly to do work with (as you have found out). In your specific case, juypter would like to install a recent version of the six library, but the system installed version is a strange old one and will not let pip update it (jupyter requires an updated version).

In general, to alleviate all future headaches, I recommend getting a different distribution of python, and putting that on your path so it is your new default. There are a couple of choices; what's important is only using one at a time (otherwise they're apt to confuse eachother, or confuse you).

  1. Python.org - From the Python developers themselves
  2. Homebrew - a unixy package manager for OS X, which has a normally-functioning python package
  3. Anaconda Python - A scientific python distribution, with many 'harder-to-install' scientific packages already available and 'just working' (including jupyter).

I recommend going with Anaconda for now, if you don't know what to choose.