Skip to content

Instantly share code, notes, and snippets.

@prjemian
Created February 8, 2019 19:41
Show Gist options
  • Select an option

  • Save prjemian/9478ded3e12fc6c2617311e0dc67693d to your computer and use it in GitHub Desktop.

Select an option

Save prjemian/9478ded3e12fc6c2617311e0dc67693d to your computer and use it in GitHub Desktop.
Run PyMCA from a custom conda environment
#!/bin/bash
# file: run_pymca.sh
#
# Runs PyMCA from a custom conda environment
# Creates and installs the environment if not present
# Installation can take about ten minutes (depends on workstation)
export CONDA_ENV_NAME=pymca_python3_qt5
export ACTIVATE=/APSshare/anaconda3/x86_64/bin/activate
# --------------------------------------------------------
# assumes conda version is <4.6
# for conda 4.6+, replace "source activate" with "conda activate"
source ${ACTIVATE} base
echo "Checking list of available conda environments..."
export EXISTING=`conda env list | grep ${CONDA_ENV_NAME}`
echo "existing |$EXISTING|"
if [ "${EXISTING}" = "" ]; then
echo "Building custom conda environment: ${CONDA_ENV_NAME}"
# next step takes a few minutes to complete
conda create -y -n ${CONDA_ENV_NAME} python=3 qt=5
conda activate ${CONDA_ENV_NAME}
# next step takes a minute or two to complete
conda install -y -c lightsource2-tag fabio silx
# next step takes less than a minute to complete
pip install pymca
conda deactivate
fi
echo "Starting PyMCA (be patient, takes about a minute to start)"
conda activate ${CONDA_ENV_NAME} && pymca &
# this command removes the custom conda environment:
# conda env remove -n ${CONDA_ENV_NAME}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment