Skip to content

Instantly share code, notes, and snippets.

@jsturdy
Last active May 31, 2018 08:00
Show Gist options
  • Save jsturdy/a82a6b7b7d497ae8ef98ee736119c6b5 to your computer and use it in GitHub Desktop.
Save jsturdy/a82a6b7b7d497ae8ef98ee736119c6b5 to your computer and use it in GitHub Desktop.
Setup user area for new GEM python packages

Instructions to set up a working user area

  • Determine the version of the package that you are using
  • Take the appropriate tar.gz file for the package (and any dependent packages if you are operating from a machine that does not have a system install of the packages, i.e., non GEM DAQ machine
  • Set up a python virtual environment in your working area:
virtualenv -p <python executable to use, e.g., python or python2.7> --system-site-packages /path/to/your/venv
. /path/to/your/venv/bin/activate
# with a python2.7 virtualenv
pip install -U importlib setuptools pip
# with a python2.6 virtualenv on slc6 default, uncomment the following line
# pip install -I importlib 'setuptools<39.2.0'  'pip<10.1.0'
# if installing the cmsgemos tarball, add --no-deps
pip install <gempython package>.tar.gz
# if pip/virtualenv fail, try with python -m pip, or python -m virtualenv

# set up the environment
export PATH=$VIRTUAL_ENV/lib/python*/site-packages/gempython/scripts:$PATH
export PATH=$VIRTUAL_ENV/lib/python*/site-packages/gempython/gemplotting/macros:$PATH

# create the mapping files
find $VIRTUAL_ENV/lib -type f -name buildMapFiles.py -exec python {} \;
  • If you use this virtual environment inside a batch job, the location of the venv must be accessible inside the batch job, and you should only set up the environment in the job, after activateing the virtual environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment