juv Exercise#
To go through these exercises, you need to create a new folder on your Desktop called bobiac_juv.
Step 1#
Create a new Jupyter Notebook with uv’s juv tool
Open the Terminal or PowerShell and navigate to the
bobiac_juvfolder.Inside the
bobiac_juvfolder, create a new folder namednb_folderand navigate into it.Inside the
nb_folder, create a new Jupyter Notebook namedbobiac_nb.ipynbusinguv’sjuvtool.Run the
bobiac_nb.ipynbnotebook in your browser usingjuv.
Solution
open the Terminal or PowerShell.
cd .../Desktop/bobiac_juvmkdir nb_foldercd .../Desktop/bobiac_juv/nb_folderuvx juv init bobiac_nb.ipynbuvx juv run bobiac_nb.ipynb
Step 2#
Add dependencies to a Jupyter Notebook with juv
In the
bobiac_nb.ipynbnotebook created in Step 1, addmatplotlib,numpy, andpandasas dependencies usingjuv.Run the notebook with
juvand import the three libraries in the first cell to confirm that they are installed and can be imported without errors.Note
If you have the
bobiac_nb.ipynbnotebook open in your browser, you need to stop it from the terminal (cmd + corctrl + c) and close the browser tab before running the notebook again withjuvor the new dependencies will not be installed.
Solution
cd .../Desktop/bobiac_juv/nb_folder(the folder created in Exercise 1)uvx juv add bobiac_nb.ipynb numpy pandas matplotlibuvx juv run bobiac_nb.ipynbadd a new
codecell in the notebook (+button)within this cell, import the three libraries:
import matplotlib import numpy as np import pandas as pd
Run the cell to confirm that the libraries are imported without errors.