Install packages in your running container
As a general rule, the packages you need for your course are installed in the course container. If a package you need seems to be missing, check and make sure you are running the correct container.
For Team projects or final course projects, you may install packages into your running container in one of the ways as described below.
Please note two things:
- You may run into versioning issues when trying to install a package. Your package and package version must be compatible with the base Python or base R version and other dependency packages in the container.
- Once your container stops and restarts this will reset any change in the environment. Your packages will not persist after a session restart.
Installing Python Packages
conda
!conda install <package name>
# for instance:
!conda install opencvpip
!pip install <package name>
# for example:
!pip install jinja2The above pip command with the ! operator is the equivalent to this longer code.
# Define PIP Installer
import pip
def install(package):
pip.main(['install','--upgrade', package])
#Notebook Requirements
install('pip')
install('jinja2')Installing R Packages
You may install R packages into your running container with this code
install.packages("<package name>")
# for example:
install.packages("rtweet")Need more information or help? Reach out to us at 📧 jcwdw@missouri.edu