parameters: (package, commit=None, **kwargs)
docstring: Install package using pip.
docstring_summary: Install package using pip.
docstring_tokens: Install package using pip .
function: def pip_install(package, commit=None, **kwargs):
    "Install package using pip."
    min_version = kwargs.get('min_version')
    if min_version:
      from pkg_resources import get_distribution, DistributionNotFound
      try:
        installed_version = get_distribution(os.path.basename(package)).version
        if LooseVersion(installed_version) >= min_version:
          print('{} {} already installed'.format(package, min_version))
          return
      except DistributionNotFound:
        pass
    if commit:
      package = 'git+https://github.com/{0}.git@{1}'.format(package, commit)
    print('Installing {0}'.format(package))
    check_call(['pip', 'install', package])
function_tokens: def pip_install ( package , commit = None , * * kwargs ) : min_version = kwargs . get ( 'min_version' ) if min_version : from pkg_resources import get_distribution , DistributionNotFound try : installed_version = get_distribution ( os . path . basename ( package ) ) . version if LooseVersion ( installed_version ) >= min_version : print ( '{} {} already installed' . format ( package , min_version ) ) return except DistributionNotFound : pass if commit : package = 'git+https://github.com/{0}.git@{1}' . format ( package , commit ) print ( 'Installing {0}' . format ( package ) ) check_call ( [ 'pip' , 'install' , package ] )