• Post author:
  • Post category:Python
  • Post last modified:March 27, 2024
  • Reading time:10 mins read
You are currently viewing Install Jupyter Notebook or Jupyterlab on Mac OS

To install Jupyter Notebook or Jupyterlab on a Mac running macOS, you typically use Python and the Python package manager, pip. Jupyter is the most popular open-source interactive computing environment that is widely used by a diverse range of individuals, including researchers, data scientists, students, and professionals. In this article let’s learn how to install Jupyter Notebook and Jupyterlab on Mac OS by using pip, conda, and brew.

Advertisements

1. Install Jupyter Notebook on Mac (macOS)

What is the Jupyter Notebook? Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations, and narrative text. It is widely used in data science, machine learning, scientific research, and education for interactive and exploratory computing. It is also used by Data Engineers to run their PySpark jobs or Pandas applications.

Using pip

Using pip to install Jupyter Notebook is a reliable and convenient choice due to its ease of use, compatibility, strong community support, and many other advantages. It ensures that you have a well-maintained and up-to-date Jupyter environment for your data analysis, coding, and research needs. Before using pip, first upgrade pip and then install the required package.


# Upgrade pip
pip install --upgrade pip

# Install Jupyter notebook
pip install notebook

# If you have pip3 use below
pip3 install notebook

Once, Jupyter Notebook is installed, you can launch it with the below command.


# Launch notebook
jupyter notebook

This opens up Jupyter Notebook in the default browser.

Install Jupyter Notebook Mac

Now select New -> PythonX and enter the below lines and select Run. On Jupyter, each cell is a statement, so you can run each cell independently when there are no dependencies on previous cells.

Depending on the version you have Jupyter Notebook installed, you might see slightly different options to create a new notebook.

Python jupyter notebook

This completes installing the Jupyter Notebook on Mac. I have tried my best to layout step-by-step instructions, In case I miss any or If you have any issues installing, please comment below. Your comments might help others.

Using conda

If you are using Anaconda, you can install Jupyter Notebook using the conda command. conda is a command-line package and environment management system that is primarily associated with Anaconda and Miniconda, two popular distributions of Python and data science packages.


# Install using conda
conda install -c conda-forge notebook

This command installs Jupyter Notebook from the conda-forge channel.

Install Jupyterlab on Mac (macOS)

JupyterLab is an interactive data science and code development environment. It provides a versatile, web-based interface with features like multi-document support, customizable layouts, and extensions, making it ideal for data analysis, research, and coding.

Install with pip on Mac


# If you use pip
pip install jupyterlab

# Using pip3
pip3 install jupyterlab

To install a specific version, use the below command.


# Install specific version
pip install jupyterlab==1.2.4

Using with conda on Mac

Using conda to install Jupyterlab on Mac OS. Here, we use conda-forge which is a community-driven collection of Conda packages. It is a specific channel within Conda that provides a large and growing collection of pre-built Conda packages.


# If you use conda
conda install -c conda-forge jupyterlab

Using mamba

Mamba is a high-performance, open-source package manager for the Conda package management system. It is designed to be faster and more efficient than the default conda package manager, particularly when it comes to dependency resolution and environment management.


# If you use mamba
mamba install -c conda-forge jupyterlab

Install JupyterLab with Homebrew

Homebrew is a Missing Package Manager for macOS (or Linux) that is used to install third-party packages on Mac OS.

Installing Jupyter from Homebrew can be a great choice for some users, primarily due to the advantages that Homebrew offers as a package manager for macOS. However, whether it’s the best choice for you depends on your specific needs and preferences.

In order to use this, first, you need to install it by using the below command.


# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

This prompts for the root password. You will need to type your root password to run this command. On a personal laptop, this is the same password you enter when you log into your Mac. If you don’t have root access, contact your system admin. You should see something like this below after the successful installation of homebrew.

download jupyterlab

Post-installation, you may need to run the below command to set the brew to your $PATH.


# Set brew to Path
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/admin/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

If the above command has issues, you can find the latest command from Homebrew.

Now, Follow the below steps to install Jupyterlab on your Mac.


# Install jupyterlab
brew install jupyterlab

# Alternatively, use below
brew install --cask jupyterlab

Homebrew will download and install JupyterLab and its dependencies.

jupyterlab install

Launch Jupyter lab


# Run Jupyterlab
jupyter lab

You should see something like this below.

install jupyter notebook os

Conclusion

In this article, you have learned different ways of installing Jupyter Notebook. I hope these steps help you with successful installation. In case if you have any issues, please comment. Note that Jupyter Notebook and JupyterLab are both interactive development environments for working with Jupyter Notebooks, code, and data.