Installing Jupyter on a Mac using Homebrew
Here's how to install Jupyter with python
and R
integration on OSX using Homebrew.
Step 0 - Install Homebrew
Read this tutorial on how to install Homebrew on OS X.
Step 1 - Install pyenv
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
Install 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.
pyenv versions
You'll also need to configure your ~/.bash_profile
.
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.
jupyter notebook
Step 6 - Done!
You're Done Installing Jupyter. Please proceed if you now want to use R language with Jupyter.
Troubleshooting
~/.bash_profile
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 -)"
Resources
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.