{"id":292,"date":"2016-11-15T21:34:46","date_gmt":"2016-11-15T13:34:46","guid":{"rendered":"http:\/\/vinta.ws\/code\/?p=292"},"modified":"2026-02-18T01:20:36","modified_gmt":"2026-02-17T17:20:36","slug":"setup-jupyter-and-other-machine-learning-tools-on-macos","status":"publish","type":"post","link":"https:\/\/vinta.ws\/code\/setup-jupyter-and-other-machine-learning-tools-on-macos.html","title":{"rendered":"Setup Jupyter and other Machine Learning tools on macOS"},"content":{"rendered":"<p>Jupyter Notebook is an interactive environment for running code in the browser. It allows you to create interactive documents that contain live code, rich text elements and visualizations. It's also a widely used tool for Data Scientists to make prototypes or demonstrations.<\/p>\n<p>ref:<br \/>\n<a href=\"http:\/\/jupyter.org\/\">http:\/\/jupyter.org\/<\/a><\/p>\n<h2>Install<\/h2>\n<pre class=\"line-numbers\"><code class=\"language-bash\">$ brew install freetype gcc libffi libpng openssl pkg-config\n$ pip install -U \n  cython \n  numpy \n  scipy \n  matplotlib \n  bokeh \n  seaborn \n  scikit-learn \n  surprise \n  gensim \n  nltk \n  pandas \n  jupyter\n\n$ pip install jupyter_contrib_nbextensions &amp;&amp; \n  jupyter contrib nbextension install --user\n\n# install kernels for Python 2 and 3\n$ python2 -m pip install ipykernel &amp;&amp; \n  python2 -m ipykernel install --user\n\n# list kernels\n$ jupyter kernelspec list\n\n# remove kernel\n$ jupyter kernelspec uninstall apache_toree_scala\n\n# start your notebook server\n$ jupyter notebook\n$ jupyter notebook --ip 0.0.0.0 --allow-root --no-browser<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/ipython.readthedocs.io\/en\/latest\/install\/kernel_install.html\">https:\/\/ipython.readthedocs.io\/en\/latest\/install\/kernel_install.html<\/a><br \/>\n<a href=\"https:\/\/jupyter.readthedocs.io\/en\/latest\/running.html#running\">https:\/\/jupyter.readthedocs.io\/en\/latest\/running.html#running<\/a><br \/>\n<a href=\"https:\/\/github.com\/ipython-contrib\/jupyter_contrib_nbextensions\">https:\/\/github.com\/ipython-contrib\/jupyter_contrib_nbextensions<\/a><\/p>\n<p>Or you could just download Anaconda and install it.<br \/>\n<a href=\"https:\/\/www.continuum.io\/downloads#osx\">https:\/\/www.continuum.io\/downloads#osx<\/a><\/p>\n<h2>Configuration<\/h2>\n<pre class=\"line-numbers\"><code class=\"language-py\"># ~\/.ipython\/profile_default\/ipython_config.py    \nc = get_config()\n\nc.InteractiveShell.ast_node_interactivity = 'all'\n\n# c.InteractiveShellApp.matplotlib = 'notebook'\nc.InteractiveShellApp.matplotlib = 'inline'<\/code><\/pre>\n<h2>Usage<\/h2>\n<h3>Automatic module reload<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-py\">%load_ext autoreload\n%autoreload 2\nimport your_module<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/blog.3blades.io\/jupyter-notebook-little-known-tricks-b0866a558017\">https:\/\/blog.3blades.io\/jupyter-notebook-little-known-tricks-b0866a558017<\/a><\/p>\n<h3>Show media in notebook<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-py\"># show image\nfrom IPython.display import Image\nImage('iris.png')\n\n# show pdf\nfrom IPython.display import IFrame\nIFrame('iris.pdf', width='100%', height=700)<\/code><\/pre>\n<h3>Django integration with django-extension<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-py\">$ python manage.py shell_plus --notebook<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/stackoverflow.com\/questions\/35483328\/how-do-i-set-up-jupyter-ipython-notebook-for-django\">https:\/\/stackoverflow.com\/questions\/35483328\/how-do-i-set-up-jupyter-ipython-notebook-for-django<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Jupyter Notebook is an interactive environment for running code in the browser. It allows you to create interactive documents that contain live code, rich text elements and visualizations. It's also a widely used tool for Data Scientists to make prototypes or demonstrations.<\/p>\n","protected":false},"author":1,"featured_media":293,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[97,4],"tags":[98,2],"class_list":["post-292","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-about-ai","category-about-python","tag-machine-learning","tag-python"],"_links":{"self":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/292","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/comments?post=292"}],"version-history":[{"count":0,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/292\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media\/293"}],"wp:attachment":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media?parent=292"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/categories?post=292"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/tags?post=292"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}