In this post I’m going to list the steps to install jupyter notebooks in a Macbook Air M1.
What is Jupyter notebook?
It’s an open-source web application that allows us to share and create documents that have live code, visualizations, and narrative text.
It supports over 40 programming languages (not only Python) and you can share those documents with others using Github, Dropbox, or email.
Why Jupyter if I’m a Java developer?
At the time of writing this blog post, I don’t have experience developing with Python and I decided to give it a try playing around with the language and with Jupyter notebooks.
Java is criticized for its verbosity as a programming language and Python is recommended for beginners because the learning curve is lower and in few lines of code you can achieve more.
Even that a vast majority of my experience has been working with Java, I’m curious about other programming languages and technologies that can help solve problems differently.
homebrew installed on your laptop is useful because it’s a package management system that allows you to install anything that you need in your mac system.
You just have to copy-paste the following command in your terminal and execute. More information available here.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
After installing it we can update
brew with the following command.
brew update && brew doctor
We then install
pyenv that lets us switching Python version easily.
brew install pyenv
with the following command, we install Python version 3.9.1
pyenv install 3.9.1
with the following command, we can add the initialization of
pyenv new values into the
.zshrc file, this way we don’t have to type the same command everytime we open a new terminal, in my case I use
echo 'eval "$(pyenv init -)"' >> .zshrc
then we set the Python version 3.9.1 globally.
pyenv global 3.9.1
With the next command, we can install
pip3 that is a package management system useful to install and manage software packages written in Python.
pip3 install jupyter
Once jupyter is installed we can run a jupyter notebook with the following command.
And ‘voila’ we have jupyter notebook running in our Macbook Air M1 on http://localhost:8888/tree
Fixing the Jupyter kernel issue
There’s a problem with Jupyter notebook kernel that stops working in our shiny Macbook m1 laptop. A workaround is explained in this George Hotz youtube video.
We have to look for
eventloops.py file in our system. To do this we can execute the following command:
find / -name eventloops.py
Then in my case, I found the file in the following path that I opened using
We have to navigate to the function
def _use_appnope() and the line of code to change is the return line. After V(‘10.9’), we have to add:
and platform.mac_ver() != 'arm64'
we save and close the file and the kernel should not stop anymore :-)
In this post, we have seen how to install Jupyter notebook in a Macbook Air M1. Now it’s time to see what things we can do with Jupyter notebooks but this will be in another post.