Usage tips
Memory management
- to free up memory used by large Python notebooks, put this line at the end of your notebook:
%reset -f
Custom conda environment
- Instructors: if a large class needs a specific custom environment please notify us to create a single shared one to conserve space
- to create a custom conda environment, open a fresh Jupyter terminal and run these commands
# load anaconda environment into the shell module load anaconda3 # create personal conda env installed at ~/.conda/envs/myconda # feel free to pick a name other than myconda conda create --name myconda -c conda pip ipykernel # activate your myconda so the python command uses it conda activate myconda # add personal icon to the Jupyter launcher for 'myconda' (relogin to Jupyter to see it) python -m ipykernel install --user --name 'myconda' --display-name 'myconda'
- to add more to a custom environment later, open a terminal and run
# activate previously-created environment module load anaconda3 conda activate myconda # install custom package, e.g., lmfit pip install lmfit
- read more about conda environments
Installing personal software
There are various ways you might install software in your own account. Here are some examples.
- configuring and building C code that comes with a GNU configure script
./configure --prefix=${HOME}/.local make --prefix=${HOME}/.local
- three different ways of using Python and pip
-
pip install --user packagename
-
pip3 install --update --user packagename
-
python3 -m pip install --user packagename
-
- using the NPM package manager
-
npm install -g --prefix=${HOME}/.local packagename
-
- R will use your home directory when installing packages. Examples:
-
# basic example if(!require(somepackage)) { install.packages("somepackage") library(somepackage) }
-
# source code example if (!require("EMMIXskew")) { install.packages('https://cran.r-project.org/src/contrib/Archive/EMMIXskew/EMMIXskew_1.0.3.tar.gz', repos = NULL, type="source") library(EMMIXskew) }
-
# install_github might need you to configure a lib path remotes::install_github("rspatial/rspatial")
-
# shell command-line example R -q -e "install.packages('GGIR', repos='http://cran.utstat.utoronto.ca/')"
-