How to quickly create a machine learning environment using Jupyter Notebook on macOS Sierra with anaconda

Introduction

I wrote a similar article about Ubuntu Server before, but it was easy on macOS, so I will organize the procedure as well.

[Ubuntu Server Edition] http://qiita.com/mix_dvd/items/29dfb8d47a596b4df36d

Install Git

Check the version.

$ git --version

If Git is not installed, the screen asking for installation will be displayed as shown below, so select "Install".

スクリーンショット 2016-07-16 14.33.50.png

If it is installed, it will be displayed as follows for macOS Sierra.

git version 2.8.4 (Apple Git-73)

Install pyenv

https://github.com/yyuu/pyenv

pyenv is a tool for installing multiple versions of Python in one environment.

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"' >> ~/.bashrc
$ exit

Restart the terminal and check the version.

$ pyenv -v
pyenv 20160629-19-ga761ff6
$ vi .bash_profile

When the editor starts, press the "i" key to copy and paste the following code, press the "esc" key, enter ": wq" and press the "enter" key to save the file and exit the editor.

.bashrc


if [ -f ~/.bashrc ] ; then
. ~/.bashrc
fi

Installation of Anaconda

https://www.continuum.io/why-anaconda

Version confirmation

Check the version of Anaconda that can be installed.

$ pyenv install -l | grep anaconda

As of July 16, 2016, the latest version was 4.1.0. Since there are many differences between version 2.x and version 3.x of Python, please select one of the following according to your environment. Unless otherwise specified, I think you can choose the 3.x series.

Python 2 series

$ pyenv install anaconda2-4.1.0
$ pyenv rehash
$ pyenv global anaconda2-4.1.0
$ echo 'export PATH="$PYENV_ROOT/versions/anaconda2-4.1.0/bin/:$PATH"' >> ~/.bashrc
$ exit

Python 3 series

$ pyenv install anaconda3-4.1.0
$ pyenv rehash
$ pyenv global anaconda3-4.1.0
$ echo 'export PATH="$PYENV_ROOT/versions/anaconda3-4.1.0/bin/:$PATH"' >> ~/.bashrc
$ exit

Restart the terminal and check the Python version.

$ python -V
Python 3.5.1 :: Anaconda 4.1.0 (x86_64)

Seaborn installation

Headquarters site https://web.stanford.edu/~mwaskom/software/seaborn/

$ pip install seaborn

Install XGBoost

Headquarters site https://xgboost.readthedocs.io/

Reference URL https://xgboost.readthedocs.io/en/latest/build.html#python-package-installation

Installation instructions for Mac https://github.com/dmlc/xgboost/blob/master/doc/build.md#building-on-osx

If Xcode is not installed, install Xcode.

After installing Xcode, execute the following command.

$ git clone --recursive https://github.com/dmlc/xgboost
$ cd xgboost
$ cp make/minimum.mk ./config.mk
$ make -j4
$ cd python-package
$ python setup.py install

Japanese environment settings for matplotlib

Download the font file "IPAfont00303.zip (19.1 MB)" of 4 typeface pack (Ver.003.03) from the following site.

http://ipafont.ipa.go.jp/old/ipafont/download.html

After downloading, execute the following command.

$ cd Download
$ unzip IPAfont00303.zip
$ mv IPAfont00303/*.ttf ~/.pyenv/versions/anaconda3-4.1.0/lib/python3.5/site-packages/matplotlib/mpl-data/fonts/ttf/
$ rm ~/.matplotlib/fontList.*.cache 

Jupyter Notebook

Headquarters site http://jupyter.org

Execute the following command in the home directory of the initial user.

$ jupyter notebook

The default browser should start automatically and you should see the Jupyter screen.

However, if you start it in your home directory, you will see various extra things and there is a risk of erroneous operation, so it is recommended to create a working directory and use it.

$ mkdir notebook
$ cd notebook
$ jupiter notebook

Thank you for your support.

Recommended Posts

How to quickly create a machine learning environment using Jupyter Notebook on macOS Sierra with anaconda
How to quickly create a machine learning environment using Jupyter Notebook with UbuntuServer 16.04 LTS with anaconda
How to quickly create a machine learning environment using Jupyter Notebook with UbuntuServer 16.04 LTS
Build a python machine learning study environment on macOS sierra
Steps to quickly create a deep learning environment on Mac with TensorFlow and OpenCV
How to create a serverless machine learning API with AWS Lambda
How to build Anaconda virtual environment used in Azure Machine Learning and link with Jupyter
How to build a Python virtual execution environment using Visual Studio Code and pipenv on a Windows machine (also Jupyter notebook)
Create a machine learning environment from scratch with Winsows 10
How to set up a Google Colab environment with Coursera's advanced machine learning courses
Until you create a machine learning environment with Python on Windows 7 and run it
Machine learning with Jupyter Notebook in OCI Always Free environment (2019/12/17)
Building a Jupyter Lab development environment on WSL2 using Anaconda3
I want to use a virtual environment with jupyter notebook!
How to batch start a python program created with Jupyter notebook
How about Anaconda for building a machine learning environment in Python?
I wanted to create a smart presentation with Jupyter Notebook + nbpresent
How to use jupyter notebook without polluting your environment with Docker
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Create an arbitrary machine learning environment with GCP + Docker + Jupyter Lab
[Python] Create a virtual environment with Anaconda
How to use jupyter notebook with ABCI
How to install cx_Oracle on macOS Sierra
Steps to create a Python virtual environment with VS Code on Windows
How to debug with Jupyter or iPython Notebook
How to create a Python virtual environment (venv)
Try using conda virtual environment with Jupyter Notebook
[Note] How to create a Ruby development environment
How to create a multi-platform app with kivy
Try using Jupyter Notebook of Azure Machine Learning
[Note] How to create a Mac development environment
Build a Python machine learning environment with a container
Install and set Jupyter Notebook to create a study note creation environment [Mac]
[Python] How to create a local web server environment with SimpleHTTPServer and CGIHTTPServer
How to create a face image data set used in machine learning (1: Acquire candidate images using WebAPI service)
Easy Machine Learning with AutoAI (Part 4) Jupyter Notebook Edition
Build a machine learning environment using PyCharm on Ubuntu environment (TensorFlow will also be introduced!)
How to set up a Python environment using pyenv
How to build a beautiful Python environment on a new Mac and install Jupter Notebook
How to create a submenu with the [Blender] plugin
Create a virtual environment with Anaconda installed via Pyenv
Build a machine learning Python environment on Mac OS
Create a comfortable Python 3 (Anaconda) development environment on windows
How to hold a hands-on seminar using Jupyter using docker
How to build a Django (python) environment on docker
How to create a Python 3.6.0 environment by putting pyenv on Amazon Linux and Ubuntu
I tried to create a reinforcement learning environment for Othello with Open AI gym
Build a machine learning application development environment with Python
Build a Python development environment using pyenv on MacOS
You don't need to install Anaconda to build a machine learning environment. Let's use Miniconda
[Python] How to create a 2D histogram with Matplotlib
Create a Japanese OCR environment with Anaconda (tesseract + pyocr)
Memo for building a machine learning environment using Python
How to build a Python environment on amazon linux 2
How to view progress bar on Jupyter Notebook to see progress
Build a machine learning environment natively on Windows 10 (x64)
How to deal with the phenomenon that Python (Jupyter notebook) executed on WSL becomes Aborted
How to set up WSL2 on Windows 10 and create a study environment for Linux commands
How to interactively draw a machine learning pipeline with scikit-learn and save it in HTML
How to connect to Cloud SQL PostgreSQL on Google Cloud Platform from a local environment with Java
I wrote a script to create a Twitter Bot development environment quickly with AWS Lambda + Python 2.7