technical:recipes:emcee-in-virtualenv

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
technical:recipes:emcee-in-virtualenv [2020-07-16 10:25] – created freytechnical:recipes:emcee-in-virtualenv [2021-02-24 23:45] (current) frey
Line 134: Line 134:
   * pyklip   * pyklip
 packages should all be present in the list. packages should all be present in the list.
 +
 +Return the shell environment to its original state before proceeding:
 +
 +<code bash>
 +$ vpkg_rollback all
 +</code>
  
 ===== VALET Package Definition ===== ===== VALET Package Definition =====
Line 139: Line 145:
 To simplify the addition of this virtualenv to the runtime environment, a VALET package definition file should be created.  If the virtualenv was installed for use by one or more members of the workgroup, the file should be created as ''${WORKDIR}/sw/valet/«env-name».vpkg_yaml'' If the virtualenv is for personal use, create the file as ''~/.valet/«env-name».vpkg_yaml'' Naturally, you must ensure that the directory (''${WORKDIR}/sw/valet'' or ''~/.valet'', respectively) exists prior to creating the package definition file. To simplify the addition of this virtualenv to the runtime environment, a VALET package definition file should be created.  If the virtualenv was installed for use by one or more members of the workgroup, the file should be created as ''${WORKDIR}/sw/valet/«env-name».vpkg_yaml'' If the virtualenv is for personal use, create the file as ''~/.valet/«env-name».vpkg_yaml'' Naturally, you must ensure that the directory (''${WORKDIR}/sw/valet'' or ''~/.valet'', respectively) exists prior to creating the package definition file.
  
-The package definition file uses [[https://yaml.org|YAML]].  Information to know before proceeding:+The package definition file uses the [[https://yaml.org|YAML]] format.  Information to know before proceeding: 
 ^Item^Description^Value in this example^ ^Item^Description^Value in this example^
 |''«env-name»''|The name of the virtualenv created|''mcmc-env''| |''«env-name»''|The name of the virtualenv created|''mcmc-env''|
 |''«prefix»''|The directory in which the ''«env-name»'' directory to hold the virtualenv was created|''/work/workgroup/sw''| |''«prefix»''|The directory in which the ''«env-name»'' directory to hold the virtualenv was created|''/work/workgroup/sw''|
 |''«version»''|The version identifier chosen for this instance of the virtualenv|''20200716.01''| |''«version»''|The version identifier chosen for this instance of the virtualenv|''20200716.01''|
 +|''«vpkg-file»''|The path to the virtualenv package definition file|''/work/workgroup/sw/valet/mcmc-env.vpkg_yaml''|
  
 The package definition file should follow this format: The package definition file should follow this format:
Line 151: Line 159:
     prefix: «prefix»/«env-name»     prefix: «prefix»/«env-name»
     description: emcee and pyKLIP python environments     description: emcee and pyKLIP python environments
 +    flags:
 +        - no-standard-paths
     default-version: "«version»"     default-version: "«version»"
     actions:     actions:
Line 165: Line 175:
 </code> </code>
  
-For the virtualenv created in the course of this recipe, the resulting file (''/work/workgroup/sw/valet/mcmc-env.vpkg_yaml''would look like:+For the virtualenv created in the course of this recipe, the resulting file ''«vpkg-file»'' would look like:
  
 <code yaml> <code yaml>
Line 171: Line 181:
     prefix: /work/workgroup/sw/mcmc-env     prefix: /work/workgroup/sw/mcmc-env
     description: emcee and pyKLIP python environments     description: emcee and pyKLIP python environments
 +    flags:
 +        - no-standard-paths
     default-version: "20200716.01"     default-version: "20200716.01"
     actions:     actions:
Line 185: Line 197:
 </code> </code>
  
 +The file can be checked for proper syntax:
 +
 +<code bash>
 +$ vpkg_check "«vpkg-file»"
 +</code>
 +
 +If all is okay, then the virtualenv can be loaded in login sessions or in job scripts as:
 +
 +<code bash>
 +$ vpkg_require «env-name»/«version»
 +</code>
 +
 +which for this recipe is:
 +
 +<code bash>
 +$ vpkg_require mcmc-env/20200716.01
 +Adding dependency `libfabric/1.6.1` to your environment
 +Adding dependency `openmpi/3.1.3` to your environment
 +Adding dependency `intel-python/2019u5:python3` to your environment
 +Adding package `mcmc-env/20200716.01` to your environment
 +$ which python3
 +/work/workgroup/sw/mcmc-env/20200716.01/bin/python3
 +$ which pip
 +/work/workgroup/sw/mcmc-env/20200716.01/bin/pip
 +</code>
 +
 +==== Adding New Instances of the virtualenv ====
 +
 +Each new instance of the virtualenv will receive a unique version identifier prior to being created.  Append a new //versions// dictionary to the package definition file:
 +
 +<code yaml>
 +mcmc-env:
 +    prefix: /work/workgroup/sw/mcmc-env
 +    description: emcee and pyKLIP python environments
 +    flags:
 +        - no-standard-paths
 +    default-version: "20200716.01"
 +    actions:
 +        - action: source
 +          script:
 +              sh: anaconda-activate.sh
 +          success: 0
 +    versions:
 +        "20200716.01":
 +            description: July 16, 2020, build 01
 +            dependencies:
 +                - openmpi/3.1.3
 +                - intel-python/2019u5:python3
 +        "20200716.02":
 +            description: July 16, 2020, build 02
 +            dependencies:
 +                - openmpi/4.0.2
 +                - intel-python/2019u5:python3
 +</code>
 +
 +where the dependencies will change if different versions of the Open MPI library or Intel distribution for Python were used when creating the virtualenv.
  
 +If the new version should be promoted to being the default (e.g. when ''vpkg_require mcmc-env/default'' is used) then alter the ''default-version'' value accordingly.
  • technical/recipes/emcee-in-virtualenv.1594909522.txt.gz
  • Last modified: 2020-07-16 10:25
  • by frey