The Notebook Mac OS
This is my preferred way to install Python and Jupyter notebook for doing scientific data analysis. There are many alternative ways of doing this that you can find on Google. I’m doing this on a MacBook Pro (Retina, 13-inch, Early 2015) with macOS High Sierra 10.13.3.
In the past, I used virtualenv
to manage virtual environments with Python 2. Python3 has built-in handling of virtual environments, so I use that here instead. If you need to use Python 2, then you’ll want to install virtualenv
(see first link at the bottom).
Install Homebrew
- Notebook brings the familiarity and ease-of-use of your smartphone to your Mac. With a trackpad, you can navigate Notebook without making a single click. Simply hover over a notebook or note and pinch to open and close notes and notebooks. Hover on a note or notebook and two finger swipe to see more information, lock, or delete.
- Note-taking with Outline incorporates the best of OS X and the App functionality. Creating, organizing, storing and editing notes with Outline is as simple as that with a real paper notebook. Outline structure is flexible. It follows and reflects the way your ideas develop.
All of these steps are done in the Mac OS Terminal, so start that first.
The notebook was given the unofficial nickname 'TiBook', after the titanium case and the PowerBook brand name; it was sold alongside the cheaper iBook. The 1 GHz version of the Titanium G4 is the last, and fastest, PowerBook that can natively run Mac OS 9 (version 9.2.2). If you use Option-Command-R during startup, in most cases you're offered the latest macOS that is compatible with your Mac. Otherwise you're offered the macOS that came with your Mac, or the closest version still available. If the Mac logic board was just replaced, you may be offered only the latest macOS that is compatible with your Mac. Download the latest version of Notebook for Mac - Notes, synched across devices and the cloud. Read 8 user reviews of Notebook on MacUpdate.
First install XCode:
Install Homebrew:
Open or create the file ~/.bash_profile and write:
Mac Notebook Laptop
Install Python 3
As of 2018-4-9, this will install Python 3 (I think previously it installed Python 2):
Set up virtual environment
By default, Python 3 comes with the ability to create virtual environments.
Make a folder to host your virtual envs:
Create a virtual env for Jupyter:
Run virtual environment and Jupyter
Start the virtual env:
Install packages for scientific computing:
Run Jupyter:
A browser window will open with the Jupyter file browser in your current working directory.
Exit Jupyter and virtual environment
Jupyter notebook will run in your terminal window until you close it (with Ctrl-C).
The Notebook Mac Os Catalina
You can close the virtual environment with:
UPDATE 2018-04-19: A very useful (and IMO essential) addition to Jupyter notebook is the Table of Contents extension. I show how I install this in a different blog post.
References
Best Notebook App For Mac
- The steps above are mostly based on Maria Mele’s “Install Python 2.7, virtualenv and virtualenvwrapper on OS X Mavericks/Yosemite”
- Documentation on Python 3 virtual environments
- Explanation of how Homebrew installs Python — i.e. why Python 3 isn’t linked to the command`python`, which motivated some of my deviations from the above blog post