Installing Jupyter on OS X using Homebrew
Here's how to install Jupyter with
R integration on OSX using Homebrew.
Step 0 - Install Homebrew
Read this tutorial on how to install Homebrew on OS X.
Step 1 - Install
Mac Os X come with Pythong 2.7 pre-installed but many Machine Learning packages are progressing to Python 3.x. Therefore, it's recommended you start using Python 3 and the best way to do that is to first install
pyenv version manager. This will allow you to install any version of Python you'd like.
First update Homebrew package manager.
brew update && brew doctor
pyenv version manager.
brew install pyenv
Step 2 - Install Python
Install Python 3.x using
pyenv. You can see a list of version from the Python website.
pyenv install -l | grep -ow [0-9].[0-9].[0-9]
pyenv install 3.x.x
Double check your work.
- You'll also need to configure your
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
If you need more help with
pyenv, I suggest you reading my other article titled Installing multiple versions of python on OS X using Homebrew
Step 3 - Set Python to Local or Global
If you only want to use Python 3.x for a specific project, then
cd to your specific directory and type:
pyenv local 3.x.x
If you'd prefer to just have Python 3.x installed globally throughout your operating system, then type:
pyenv global 3.x.x
Step 4 - Install Jupyter
Jupyter is an acronym for Julia, Python and R but these days, other languages are also included such as Ruby.
brew install jupyter
Step 5 - Start Jupyter
Now it's time to start the jupyter notebook.
Step 6 - Done!
You're Done Installing Jupyter. Please proceed if you now want to use R language with Jupyter.
Step 7 - Configuring Jupyter for
The vanilla install of Jupyter will come with Python pre-installed but I want to work with R. Here's how.
Terminal and install a few more R-related packages using Homebrew.
brew install libgit2
Open up R within Terminal.
Install these r libraries.
install.packages(c('repr', 'IRdisplay', 'evaluate', 'crayon', 'pbdZMQ', 'devtools', 'uuid', 'digest', 'git2r'))
Time to install the R package.
devtools::install_github allows you to install packages from Github.
Step 8 - Make R visible to Jupyter
Install the Interactive R kernel system-wide.
IRkernel::installspec(user = FALSE)
Step 9 - Create a new File
You should now be able to see R within Jupyter.
If you're struggling to get configure bash profile, this has also worked for a few different developers.
export PYENV_ROOT=/usr/local/opt/pyenv eval "$(pyenv init -)"
Although it takes a little bit of extra work to get R working with Jupyter, it's totally worth it. Otherwise, if you want to import data, clean it, structure it and process it, you'll have to have to learn all of these other Python libraries to do what R does natively.
- NumPy supports scientific computing and linear algebra support.
- Pandas provide data frames which make it easy to access and analyze data. This is a data manipulation tool.
- Mat plotlib is a 2D publication library that produces high quality graphics.
- Scikit-learn's purpose is to support machine learning and therefore it's used for many of the tasks performed routinely in machine learning. A few key features are:
- It works well with the libraries stated above.
- It helps integrate the algorithms we will use for predictive models.
- Methods that will help us pre-process data.
- Methods for helping us measure the performance of our models.
- Methods for splitting data into test sets
- Methods for pre-processing data before training.
- Methods for creating trained models, tuning models and identifying which features within the models are important.