{"record":{"id":"02c194432a43bedf","repo":"apache/beam","slug":"please-install-apache-beam-dataframe","errorCode":null,"errorMessage":"Please install apache_beam[dataframe]","messagePattern":"Please install apache_beam\\[dataframe\\]","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/textio.py","lineNumber":1113,"sourceCode":"        as opposed to the entire file being a valid JSON object or list.\n        Defaults to True if orient is 'records' (unlike Pandas).\n      **kwargs: Extra arguments passed to `pandas.Dataframe.to_json`\n        (see below).\n    \"\"\"\n    from apache_beam.dataframe.io import WriteViaPandas\n    if num_shards is not None:\n      kwargs['num_shards'] = num_shards\n    if file_naming is not None:\n      kwargs['file_naming'] = file_naming\n    if lines is None:\n      lines = orient == 'records'\n    return 'WriteToJson' >> WriteViaPandas(\n        'json', path, orient=orient, lines=lines, **kwargs)\n\nexcept ImportError:\n\n  def no_pandas(*args, **kwargs):\n    raise ImportError('Please install apache_beam[dataframe]')\n\n  for transform in ('ReadFromCsv', 'WriteToCsv', 'ReadFromJson', 'WriteToJson'):\n    globals()[transform] = no_pandas\n","sourceCodeStart":1095,"sourceCodeEnd":1117,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/textio.py#L1095-L1117","documentation":"When pandas (and hence the csv/json DataFrame I/O) is not installed, apache_beam.io.textio stubs ReadFromCsv/WriteToCsv/ReadFromJson/WriteToJson with the no_pandas function, which raises ImportError on any use. It exists so the module imports cleanly without the optional dependency.","triggerScenarios":"Calling ReadFromCsv, WriteToCsv, ReadFromJson or WriteToJson in an environment where pandas is absent (the apache_beam.io.textio import succeeded but the pandas-dependent block hit ImportError).","commonSituations":"Minimal docker images or runners with apache-beam installed without the [dataframe] or [gcp] extras; CI environments without pandas.","solutions":["Install pandas: pip install apache_beam[dataframe] (or pip install pandas)","Pin pandas in requirements.txt for Dataflow workers","Use ReadFromText with a custom coder/parse function if pandas is not desired"],"exampleFix":"// before\nbeam.io.ReadFromCsv('gs://bucket/data.csv')\n// after\n# requirements.txt: apache-beam[dataframe]\nbeam.io.ReadFromCsv('gs://bucket/data.csv')","handlingStrategy":"fallback","validationCode":"try:\n    import pandas  # noqa\n    PANDAS_AVAILABLE = True\nexcept ImportError:\n    PANDAS_AVAILABLE = False","typeGuard":null,"tryCatchPattern":"try:\n    rows = beam.io.ReadFromCsv(path)\nexcept ImportError:\n    # fallback: plain text + manual parsing\n    rows = beam.io.ReadFromText(path) | beam.Map(parse_csv_line)","preventionTips":["Install apache-beam[dataframe] in every environment (local, CI, workers)","List pandas in requirements.txt for Dataflow pipelines","Check import availability at pipeline-construction time, not runtime"],"tags":["python","beam","io","pandas","dependency"],"backgroundTag":"missing-optional-dependency","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}