Skip to main content

Wrappers for using LHCb CVMFS conda installations

Project description

LHCb Conda Wrappers

Wrapper scripts for providing access to conda environments which are installed on CVMFS.

Standard Usage

The main environment provided is named default and aims to provide most software tools that will be needed for analaysis that is performed outside of the standard LHCb software stack. This includes a recent version of Python 3, ROOT, Snakemake, jupyterlab, matplotlib, scikit-learn, tensorflow and many more.

Basic usage

Environments can be activated using the lb-conda command which works similarly to lb-run. To launch a bash shell inside the default environment run:

$ lb-conda default bash
[bash-5.0]$ python --version
Python 3.7.6
[bash-5.0]$ root --version
ROOT Version: 6.20/04
Built for linuxx8664gcc on Apr 20 2020, 15:03:00
From @

Alternative commands can be ran directly using:

$ lb-conda default python -c 'import math; print(math.sqrt(2))'
1.4142135623730951

Including texlive

A fully featured texlive installation is not included in any of the environments due to it's large size however one can be added by passing the --texlive argument.

$ lb-conda --texlive default latex --version
pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020)
kpathsea version 6.3.2
Copyright 2020 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.02

Versioning

Occasionally new versions of the default environment will be made to add new packages and generally keep it up-to-date. If you wish to use an older version you can list the available versions using:

$ lb-conda --list default
2019-12-26
2020-05-14

The 2020-05-14 version can explicitly chosen using:

$ lb-conda default/2020-05-14 bash

Customising

As the conda environment used is installed on the read-only CVMFS filesystem the usual pip install and conda install commands will not work. Two options are provided to allow environments to be customised.

Installing additional python packages

This is the preferred option as most data will be kept on CVMFS and works by creating a virtual environment on top of the CVMFS installed environment. It is however limited to only allowing pip installed Python packages and locally built software.

To create the virtual environment in a local directory ("my-local-directory") run

$ lb-conda-dev virtual-env default my-local-directory

The environment can now be used similarly to lb-conda default using the run script:

$ my-local-directory/run bash

To upgrade the uproot Python package run:

$ my-local-directory/run bahs
[bash-5.0]$ python -c 'import uproot; print(uproot.__version__)'
3.11.6  # <- Original version
[bash-5.0]$ pip install --upgrade uproot
Collecting uproot
# Truncated output
Successfully installed uproot-3.11.7
[bash-5.0]$ python -c 'import uproot; print(uproot.__version__)'
3.11.7  # <- New version

To install a locally compiled application in the virtual environment you should set the install prefix to be the absolute path to your local directory. How this is done will depend on the build system used by the specific application.

Fully customising an environment

This option is discouraged, especially when running on AFS/EOS as it will result in a large amount of data and many small files being copied to your local directory. It does however allow you to completely clone the environment and then make any modifications.

TODO: This is not currently documented...

Advanced usage

Using non-default environments

To see the full list of available environments run:

$ lb-conda --list
B2OC/b2dstdspi-gpu
B2OC/b2dstdspi
Charm/D02KsHH
Semilep/rdst
default
DPA/analysis-productions-certification
DPA/analysis-productions

A custom environment can then be chosen using it's name:

$ lb-conda Charm/D02KsHH python --version
Python 3.6.5 :: Anaconda, Inc.

Suggesting new or upgraded packages in the default environment

Please open an issue here explaining what should be added/upgraded and why.

Adding new environments to CVMFS

This is not yet widely available available. If you have a strong reason to add an environment please open an issue here to explaing what your requirements are.

Acces conda environments from a CI job.

Add the the tag cvmfs for the job to be executed in a shared runner where CVMFS is mounted, and source the LbEnv environment.

testjob:
  tags:
    - cvmfs
  before_script:
    - source /cvmfs/lhcb.cern.ch/lib/LbEnv
  script:
    - lb-conda default snakemake -j

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

LbCondaWrappers-0.2.0.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

LbCondaWrappers-0.2.0-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file LbCondaWrappers-0.2.0.tar.gz.

File metadata

  • Download URL: LbCondaWrappers-0.2.0.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for LbCondaWrappers-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bcbed18b30edc505aac4741e1620c9b21369442625f6d35c4e1b6d25280b74dd
MD5 0cac3b767799229bfe3d3327f8fa6989
BLAKE2b-256 80758b52e5aa7c47fe6cc97793c92f5f3ab526c4ed8ebe75fc74aed12d53d75e

See more details on using hashes here.

File details

Details for the file LbCondaWrappers-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: LbCondaWrappers-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10

File hashes

Hashes for LbCondaWrappers-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1f25263ae4b1dd2d81a7f96643849f4fb89df5116d58dd52ce0eed8176ea0e4
MD5 29a873d2a85ee337885c697ddccd6f3d
BLAKE2b-256 26dfc68622b2f1088cea17bb617868d17fb5f1fe1e68b7fcd13ed686d9e7ad99

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page