Installing and Using Jupyter Notebooks#
You should already have Anaconda Python installed on your system.
Jupyter#
Jupyter (Julia, Python, R) notebooks mix code with markdown (a language for basic text formatting) in your browser. This document is a Jupyter notebook, and the text is written in markdown.
You can run code in code cells, like this:
1 + 1
2
We’ll use Jupyter notebooks for Python, but you can use notebooks for other languages as well (such as Julia and R, but also a variety of others).
Install Jupyter to the conda base environment#
This will allow you to launch Jupyter notebooks without activating your pycourse
environment.
First, launch a terminal, and install notebooks in your base environment
(base) $ conda install -c conda-forge notebook
(-c conda-forge
tells conda
to install from the conda-forge
channel).
Test your installation#
After installation, you should see a jupyter
command is now available.
(base) $ which jupyter
~/miniconda3/bin/jupyter
Install A Kernel for your environment#
The next thing you need to do is install a kernel for your pycourse
environment. This will allow you to run code in Jupyter notebooks using the same setup as you would if you activate pycourse
.
First, activate your pycourse
environment in a terminal
(base) $ conda activate pycourse
(pycourse) $
Next, install the ipykernel
package using conda
(pycourse) $ conda install ipykernel -c conda-forge
Now, you run the installation
(pycourse) $ python -m ipykernel install --user --name pycourse --display-name "Python (pycourse)"
Finally, deactivate your pycourse
environment
(pycourse) $ conda deactivate
Launch a Jupyter notebook server#
Now, to launch a Jupyter notebook server, simply type
(base) $ jupyter notebook
You can launch the notebook server from any directory.
You can either create new notebooks, or launch existing notebooks.