Mynerva will use the Project.toml
and Manifest.toml
present in the directory to download and install the exact set of packages that you're using locally.
To create these files:
using Pkg
Pkg.activate(".")
# Add whatever packages you plan to use for the codex here
Pkg.add("Interact")
You can (and should!) delete these lines from the notebook after you've run them.
Pkg.activate
or Pkg.add
commands in the final notebook.Pkg.activate
the first time you open the notebook (this is what creates the Project.toml
and Manifest.toml
files).Unfortunately, Python's native dependency management is not as good as Python's. Pathbird will use a requirements.txt file if it's present in the directory to choose what packages to install. In general, it's a best practice to specify the exact version of the dependencies you're using.
# requirements.txt
numpy==1.20.1
pandas==1.2.3
Consider using a virtualenv to isolate the packages that you are using for your course materials from all the other packages on your system. Using this approach helps make sure that the set of packages that you're using on your local machine exactly matches the packages your students will be using in the cloud.
Using Virtual Environments in Jupyter Notebook and Python
Make sure to create new notebooks using the kernel corresponding to this virtualenv. For existing notebooks, you can change the kernel via the Kernel > Change Kernel...
menu in Jupyter.
Before uploading a codex, be sure to generate the requirements.txt file. This must be done for every codex before uploading.
# replace "myenv" with the path to your virtualenv
source myenv/bin/activate
cd path/to/codex
pip3 freeze > requirements.txt