docstr: Retrieves the version of a Python package from Pip. This function avoids importing
  the package which might not work on systems without a GPU.
  
  Returns `None` if the package isn't installed.
docstr_tok: ["Retrieves","the","version","of","a","Python","package","from","Pip",".","This","function","avoids","importing","the","package","which","might","not","work","on","systems","without","a","GPU",".","Returns","`","None","`","if","the","package","is","n't","installed","."]
code: def get_from_pip(self, lookup: str, key=None):
      """Retrieves the version of a Python package from Pip. This function avoids importing
      the package which might not work on systems without a GPU.
  
      Returns `None` if the package isn't installed.
      """
      if key is None:
          key = lookup
      self.contdata[key] = self.ERROR
      p = subprocess.run(  # nosec B602
          f"python -m pip show '{lookup}'",
          shell=True,
          capture_output=True,
          check=False,
      )
      result = p.stdout.decode("utf-8")
      if p.returncode != 0:
          logger.info(
              "Failed to get package version from pip: %s", lookup
          )
          return
      versions = [
          line.split()[-1]
          for line in result.split("\n")
          if line.startswith("Version:")
      ]
      if len(versions) == 1:
          self.contdata[key] = versions[0].strip()
      else:
          logger.info(
              "Failed to extract version from pip output: %s", result
          )
  
imports: import argparse
  import json
  import logging
  import os
  import subprocess
  import sys
  from collections import defaultdict
  from datetime import date
  from datetime import datetime
  from pathlib import Path
  import yaml
  from github import Github
  from github.GithubException import GithubException
  from github.GitRef import GitRef
  from semver import VersionInfo
label_desc: Use image node_id 4 for calling the SupportMatrixExtractor obj's underlying member method code with example usage: obj.get_from_pip(lookup, key) without return types