class require(reqs=None, *args, exact=False, detailed=False, die=True, warn=True, verbose=True, **kwargs)[source]#

Check whether environment requirements are met. Alias to pkg_resources.require().

  • reqs (list/dict) – a list of strings, or a dict of package names and versions

  • args (list) – additional requirements

  • kwargs (dict) – additional requirements

  • exact (bool) – use ‘==’ instead of ‘>=’ as the default comparison operator if not specified

  • detailed (bool) – return a dict of which requirements are/aren’t met

  • die (bool) – whether to raise an exception if requirements aren’t met

  • warn (bool) – if not die, raise a warning if requirements aren’t met’

  • verbose (bool) – print out the exception if it’s not being raised or warned


sc.require(reqs={'numpy':'1.19.1', 'matplotlib':'3.2.2'})
sc.require('numpy>=1.19.1', 'matplotlib==3.2.2', die=False)
sc.require(numpy='1.19.1', matplotlib='==4.2.2', die=False, detailed=True)

New in version 1.2.2. New in version 3.0.0: “warn” argument