Skip to content

Instantly share code, notes, and snippets.

@jcreinhold
Last active May 16, 2021 19:58
Show Gist options
  • Save jcreinhold/57ca03528916ce72914c89e5c5af4ddb to your computer and use it in GitHub Desktop.
Save jcreinhold/57ca03528916ce72914c89e5c5af4ddb to your computer and use it in GitHub Desktop.
Create a conda environment for working with brain images in Jupyter
#!/usr/bin/env bash
#
# use the following command to run this script: source ./create_env.sh
#
# ** `source` in the above command is necessary for this script to run correctly **
#
# Created on: May 14, 2021
# Author: Jacob Reinhold ([email protected])
if [[ "$OSTYPE" != "linux-gnu" && "$OSTYPE" != "darwin"* ]]; then
echo "Operating system must be either linux or OS X"
return 1
fi
command -v conda >/dev/null 2>&1 || { echo >&2 "anaconda required but not installed. Aborting."; return 1; }
# first make sure conda is up-to-date
conda update -n base conda --yes
packages=(
jupyterlab
matplotlib
nb_conda
numpy
pandas
scikit-image
scikit-learn
scipy
)
conda_forge_packages=(
ipywidgets
jupyterlab_widgets
nibabel
nilearn
)
conda create --override-channels -c defaults -n neuroimage python=3.8 "${packages[@]}" -y
conda activate neuroimage
conda install --override-channels -c defaults -c conda-forge "${conda_forge_packages[@]}" -y
pip install git+git://github.com/jcreinhold/niwidgets # PyPI package seems broken.
echo "create_env.sh script finished"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment