Build a python data analysis environment on Mac (El Capitan)

Build an environment for data analysis using python on Mac (El Capitan).

Advance preparation

homebrew http://brew.sh/index_ja.html Install homebrew, a package management tool for mac.

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

homebrew cask https://caskroom.github.io/

Since miniconda described later does not exist in homebrew, install homebrew cask.

$ brew tap caskroom/cask

miniconda http://conda.pydata.org/docs/

Install miniconda as a tool for managing your virtual environment.

$ brew cask install miniconda

Add the following description to .bash_profile etc. so that the installed miniconda will be in the PATH. Replace <user_name> with any user.

~/.bash_profile


export PATH="/Users/<user_name>/miniconda3/bin:$PATH"

There seem to be various environment management tools for python, but so far conda alone is not inconvenient. If you know any inconvenience, please let me know.

Building a virtual environment

Create a virtual environment for analysis with miniconda. It will be installed if you specify the required packages when creating the environment. Is it pandas, numpy, matplotlib, scikit-learn, jupyter, etc.? Basically, you can enter everything with anaconda.

$ conda create -n testenv python=3 anaconda

Switch to the virtual environment. (Environment name) is displayed at the beginning of the prompt.

$ source activate testenv
(testenv) $

When returning from the virtual environment to the original environment, it is as follows.

(testenv) $ source deactivate
$

Installation of additional packages

conda If you want to add a package to your virtual environment, you can find it in conda and install it.

(testenv) $ conda search graphviz
Fetching package metadata .......
graphviz                     2.38.0                        2  defaults        
                             2.38.0                        3  defaults        
                             2.38.0                        4  defaults        
(testenv) $ conda install graphviz

Even if you can't find it by searching, you can install it by specifying the channel if you search on Google and find it. When starting jupyter notebook, the warning "No module named'nbbrowserpdf'" appears, so try installing it.

(testenv) $ conda install --channel anaconda-nb-extensions nbbrowserpdf

pip If you still can't find it, or conda doesn't provide the version you want, you can also use pip to install the package in that virtual environment.

(testenv) $ pip install tansorflow

Other

Jupyter notebook Tips

py3:~/.jupyter/jupyter_notebook_config.py


c.NotebookApp.mathjax_url = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js'

css:~/.jupyter/custom/custom.css


.CodeMirror pre, .output pre { font-family: "Source Han Code JP", monospace; }
$ conda install -c conda-forge jupyter_contrib_nbextensions

Recommended Posts

Build a python data analysis environment on Mac (El Capitan)
Build a Python environment on Mac (Mountain Lion)
Build a Python development environment on your Mac
Build a Python environment with OSX El capitan
Build a Python environment on your Mac using pyenv
Building a Python environment on Mac
Create a Python environment on Mac (2017/4)
Install python3 on Mac (El Capitan)
Build a python3 environment on CentOS7
Build a python environment with pyenv (OS X El Capitan 10.11.3)
Build a python environment on MacOS (Catallina)
Create a python environment on your Mac
Build Python environment with Anaconda on Mac
Build a Python + OpenCV environment on Cloud9
How to rebuild python environment from pyenv on Mac environment (El Capitan)
Build a Python environment on your Mac with Anaconda and PyCharm
Simply build a Python 3 execution environment on Windows
Build a python environment with ansible on centos6
Build a Python development environment on Raspberry Pi
[Python] Notes on data analysis
Build Python environment on Windows
Build python environment on windows
Build a Python environment offline
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Install Python3 on Mac and build environment [Definitive Edition]
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Build a local development environment for Laravel6.X on Mac
Build a GVim-based Python development environment on Windows 10 (1) Installation
How to build a Django (python) environment on docker
Build a Python development environment using pyenv on MacOS
How to build a Python environment on amazon linux 2
Build a data analysis environment with Kedro + MLflow + Github Actions
Build a python machine learning study environment on macOS sierra
Build a machine learning environment on mac (pyenv, deeplearning, opencv)
Create a Python (pyenv / virtualenv) development environment on Mac (Homebrew)
How to build a new python virtual environment on Ubuntu
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Building a Python environment on Ubuntu
Building a Python environment on a Mac and using Jupyter lab
Build a GVim-based Python development environment on Windows 10 (2) Basic settings
Build a Python environment and transfer data to the server
Create a python environment on centos
Environment construction of python3.8 on mac
Build a Python extension for E-Cell 4 on Mac OSX (Yosemite)
<Python> Build a dedicated server for Jupyter Notebook data analysis
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
Create a virtual environment for python on mac [Very easy]
Build a python environment on CentOS 7.7 for your home server
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
# 3 Build a Python (Django) environment on AWS EC2 instance (ubuntu18.04) part2
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Create a USB boot Ubuntu with a Python environment for data analysis
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Build Python3 and OpenCV environment on Ubuntu 18.04
I want to build a Python environment
[Mac] Building a virtual environment for Python
Creating a python virtual environment on Windows
I installed Kivy on a Mac environment
Build a python virtual environment with pyenv
Data analysis environment centered on Datalab (+ GCP)
Build a modern Python environment with Neovim