{"record":{"id":"19d996fc7e3693a6","repo":"apache/beam","slug":"full-traceback-n-pip-install-failed-for-package-n-output","errorCode":null,"errorMessage":"Full traceback: {} \\n Pip install failed for package: {} \\n Output from execution of subprocess: {}","messagePattern":"Full traceback: (.+?) \\\\n Pip install failed for package: (.+?) \\\\n Output from execution of subprocess: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/utils/processes.py","lineNumber":56,"sourceCode":"\nif TYPE_CHECKING:\n  call = subprocess.call\n  check_call = subprocess.check_call\n  check_output = subprocess.check_output\n  Popen = subprocess.Popen\n\nelse:\n\n  def call(*args, **kwargs):\n    if force_shell:\n      kwargs['shell'] = True\n    try:\n      out = subprocess.call(*args, **kwargs)\n    except OSError as e:\n      raise RuntimeError(\"Executable {} not found\".format(args[0])) from e\n    except subprocess.CalledProcessError as error:\n      if isinstance(args, tuple) and (args[0][2] == \"pip\"):\n        raise RuntimeError( \\\n          \"Full traceback: {}\\n Pip install failed for package: {} \\\n          \\n Output from execution of subprocess: {}\" \\\n          .format(traceback.format_exc(), args[0][6], error. output)) from error\n      else:\n        raise RuntimeError(\"Full trace: {}\\\n           \\n Output of the failed child process: {} \" \\\n          .format(traceback.format_exc(), error.output)) from error\n    return out\n\n  def check_call(*args, **kwargs):\n    if force_shell:\n      kwargs['shell'] = True\n    try:\n      out = subprocess.check_call(*args, **kwargs)\n    except OSError as e:\n      raise RuntimeError(\"Executable {} not found\".format(args[0])) from e\n    except subprocess.CalledProcessError as error:\n      if isinstance(args, tuple) and (args[0][2] == \"pip\"):","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/utils/processes.py#L38-L74","documentation":"processes.call catches subprocess.CalledProcessError and, when the command looks like a pip invocation, raises this RuntimeError embedding the full traceback, the pip package argument, and pip's captured output.","triggerScenarios":"Calling processes.call('pip', ..., 'install', package, ...) (the check inspects args[0][2] == 'pip') and pip exits with a nonzero status, e.g. when shell/split-string form ['pip','install','pkg'] is used.","commonSituations":"Pip install failing due to no network access, nonexistent package version, missing build toolchain for sdists, no-PyPI restriction on locked-down runners, or no matching distribution for the platform.","solutions":["Inspect the embedded pip output in the exception for the real pip failure cause","Verify the package name/version exists and is compatible with the Python version","Ensure network/proxy access to PyPI (or use --index-url to an internal index)","Pre-install packages in the container/requirement file instead of runtime pip install"],"exampleFix":"// before\nprocesses.call('pip install some-pkg==9.9')  # version doesn't exist\n// after\nprocesses.call('pip', 'install', 'some-pkg==1.2.3')  # verified available version","handlingStrategy":"try-catch","validationCode":"# check the package exists in the index first\nimport subprocess\nr = subprocess.run(['pip', 'download', '--no-deps', '-d', tmpdir, 'pkg==1.2.3'], capture_output=True)\nassert r.returncode == 0, r.stderr","typeGuard":null,"tryCatchPattern":"try:\n    processes.call('pip', 'install', 'pkg==1.2.3')\nexcept RuntimeError as e:\n    if 'Pip install failed' in str(e):\n        logging.error('pip failed: %s', e)  # embedded output shows pip's cause\n        raise SystemExit(1) from e\n    raise","preventionTips":["Pass pip commands as a list ('pip', 'install', 'pkg') so args are parsed correctly","Pin exact versions known to exist for your Python version/platform","Pre-install dependencies in the image instead of at runtime","Ensure network access to PyPI or configure an internal index"],"tags":["python","subprocess","pip","install-failed"],"backgroundTag":"pip-install-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}