apache/beam · error
error installing beam package
Error message
error installing beam package: %v
What it means
Raised in expansionx.SetUpPythonEnvironment when installing the apache_beam package (beamPackage) into the expansion service virtualenv fails. The message includes the specific beam package spec being installed. Without apache_beam, the Python expansion service cannot start.
Solutions
- Use a supported Python version (e.g. 3.8–3.11) that has apache_beam wheels on PyPI
- Run the install manually in the venv to read the real pip resolution error
- Ensure network/proxy access to PyPI and sufficient disk space
- Remove conflicting preinstalled apache_beam/pyparsing versions in the environment chain
Example fix
// before python3.12 -m venv venv # no apache_beam wheel yet // after python3.10 -m venv venv # supported interpreter with wheels
Defensive patterns
Strategy: validation
Validate before calling
if !supportedPythonForBeam(pyVersion) { // e.g. allow only 3.8-3.11
return fmt.Errorf("python %s has no apache_beam wheels; use a supported version", pyVersion)
} Try / catch
python, err := expansionx.SetUpPythonEnvironment(ctx, py, pkg, extras)
if err != nil && strings.Contains(err.Error(), "error installing beam package") {
return fmt.Errorf("apache_beam install failed; check Python version/network and run pip manually for details: %w", err)
} Prevention
- Run a Python version with published apache_beam wheels
- Preinstall apache_beam in a test venv to validate the package spec
- Avoid conflicting pins (pyparsing, protobuf) in the same environment
When it happens
Trigger: startPythonExpansionService -> SetUpPythonEnvironment where `pip install <beamPackage> pyparsing==2.4.2` fails: unsatisfiable dependencies, no matching apache_beam wheel for the Python version/platform, or network failure.
Common situations: Using a Python version with no prebuilt apache_beam wheel (too new/old); PyPI unreachable; conflicts from an existing apache_beam or incompatible pyparsing; disk space or compiler missing for source builds.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Google Cloud Dataflow runner not available, please install…
- Google Cloud Dataflow runner not available, please install…
- A BigQuery table or a query must be specified
- A cluster_identifier should be Optional[Union[str…
- A context manager constructor (not a fully constructed…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/d417246dcd219d17.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/core/runtime/xlangx/expansionx/download.go:475
)
venvPython := filepath.Join(venvDir, "bin", "python")
if _, err := os.Stat(venvPython); err != nil {
err := exec.Command(py, "-m", "venv", venvDir).Run()
if err != nil {
return "", errors.Wrap(err, "error creating new virtual environment for python expansion service")
}
err = exec.Command(venvPython, "-m", "pip", "install", "--upgrade", "pip").Run()
if err != nil {
return "", errors.Wrap(err, "error upgrading pip")
}
err = exec.Command(venvPython, "-m", "pip", "install", "--upgrade", "setuptools").Run()
if err != nil {
return "", errors.Wrap(err, "error upgrading setuptools")
}
err = exec.Command(venvPython, "-m", "pip", "install", beamPackage, "pyparsing==2.4.2").Run()
if err != nil {
return "", errors.Wrap(err, fmt.Sprintf("error installing beam package: %v", beamPackage))
}
if len(extraPackages) > 0 {
cmd := []string{"-m", "pip", "install"}
cmd = append(cmd, extraPackages...)
err = exec.Command(venvPython, cmd...).Run()
if err != nil {
return "", errors.Wrap(err, "error installing dependencies")
}
}
err = exec.Command(venvPython, "-c", "import apache_beam").Run()
if err != nil {
return "", errors.Wrap(err, "apache beam installation failed in virtualenv")
}
}
return venvPython, nil
}
View on GitHub (pinned to 12126d8942)