Below is code that can be inserted into a cell of a Jupyter notebook to install python packages.
#Define PIP Installer
import pip
def install(package):
pip.main(['install','--upgrade', package])
#Notebook Requirements
install('pip')
install('jinja2')
Alternatively, you can use the ! operator which tell Jupyter to send the succeeding command to the OS. Both commands are equivalent.
!pip install jinja2
Please note that once your container stops and restarts this will reset any change in the environment. Your packages will not persist after a session restart.