Skip to content

Instantly share code, notes, and snippets.

@RooseveltAdvisors
Last active April 28, 2017 13:49
Show Gist options
  • Save RooseveltAdvisors/3d3ce4cfddd34003deb1699317153704 to your computer and use it in GitHub Desktop.
Save RooseveltAdvisors/3d3ce4cfddd34003deb1699317153704 to your computer and use it in GitHub Desktop.

anaconda2

  1. Download and install Anaconda https://www.continuum.io/downloads. Restart Terminal. Or, if you’d prefer to not get the full Anaconda software, check out this post.
wget https://repo.continuum.io/archive/Anaconda2-4.3.1-MacOSX-x86_64.sh
bash Anaconda2-4.3.1-MacOSX-x86_64.sh 
  1. In terminal, type
/Users/zeta/anaconda/bin/pip install matlab_kernel
/Users/zeta/anaconda/bin/python -m matlab_kernel install
  1. Point the kernel to your version of Matlab.
export MATLAB_EXECUTABLE=/Applications/MATLAB_R2017a.app/bin/matlab
echo "export MATLAB_EXECUTABLE=/Applications/MATLAB_R2017a.app/bin/matlab" >> ~/.bash_profile

Of course, make sure the location and version of Matlab match yours.

  1. Install MATLAB Engine API for Python
cd /Applications/MATLAB_R2017a.app/extern/engines/python/
/Users/zeta/anaconda/bin/python setup.py install
  1. Start Jupyter
export PATH="/Applications/MATLAB_R2017a.app/bin/:$PATH"
export MATLAB_EXECUTABLE=/Applications/MATLAB_R2017a.app/bin/matlab
export LANG=en_US.UTF-8;export LC_ALL=en_US.UTF-8
~/anaconda/bin/jupyter notebook --ip=0.0.0.0 --NotebookApp.token=''

anaconda3

  1. Download and install Anaconda https://www.continuum.io/downloads. Restart Terminal. Or, if you’d prefer to not get the full Anaconda software, check out this post.
wget https://repo.continuum.io/archive/Anaconda3-4.3.1-MacOSX-x86_64.sh
bash Anaconda3-4.3.1-MacOSX-x86_64.sh
/Users/zeta/anaconda3/bin/conda install python=3.5.0
  1. In terminal, type
/Users/zeta/anaconda3/bin/pip install matlab_kernel
/Users/zeta/anaconda3/bin/python -m matlab_kernel install
  1. Point the kernel to your version of Matlab.
export MATLAB_EXECUTABLE=/Applications/MATLAB_R2017a.app/bin/matlab
echo "export MATLAB_EXECUTABLE=/Applications/MATLAB_R2017a.app/bin/matlab" >> ~/.bash_profile

Of course, make sure the location and version of Matlab match yours.

  1. Install MATLAB Engine API for Python
cd /Applications/MATLAB_R2017a.app/extern/engines/python/
/Users/zeta/anaconda3/bin/python setup.py install
  1. Start Jupyter
export PYTHONPATH=~/opt/spark-2.1.0-bin-hadoop2.7/python:~/opt/spark-2.1.0-bin-hadoop2.7/python/lib/py4j-0.10.4-src.zip
export PATH="/Applications/MATLAB_R2017a.app/bin/:$PATH"
export MATLAB_EXECUTABLE=/Applications/MATLAB_R2017a.app/bin/matlab
export LANG=en_US.UTF-8;export LC_ALL=en_US.UTF-8
cd ~/opt/git/
/Users/zeta/anaconda3/bin/jupyter notebook --ip=0.0.0.0 --NotebookApp.token='' --debug

Reference :

  1. https://www.mathworks.com/matlabcentral/answers/53454-matlab-equivalent-to-ipython-notebook#comment_332385
  2. https://www.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment