Skip to content

False attribute access errors for load_iris() return type #8059

Description

@rohanbari

Environment data

  • Pylance version: 2026.2.1
  • OS and version: Win11 Microsoft Windows [Version 10.0.26200.8457]
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.14.5

Code Snippet

from sklearn.datasets import load_iris


def main():
    # Load Iris dataset
    iris = load_iris()

    X = iris.data
    y = iris.target
    target_names = iris.target_names

Expected behavior

No type errors; load_iris() should be recognized as returning a Bunch with valid attributes.

Actual behavior

Cannot access attribute "data" for class "tuple[Bunch, tuple[Unknown, ...]]"
Attribute "data" is unknown

Logs

2026-05-29 00:08:24.126 [info] Telemetry level is off
2026-05-29 00:08:24.126 [info] Experiments are disabled, only manually opted experiments are active.
2026-05-29 00:08:24.126 [warning] Dir "c:\Users\rohan\Code\ug-semester-6\.pixi\envs" is not watchable (directory does not exist)
2026-05-29 00:08:24.282 [info] > conda info --json
2026-05-29 00:08:24.300 [info] Skipping ActivatedEnv Detection:  process.env.VSCODE_CLI !== '1'
2026-05-29 00:08:24.451 [info] Python interpreter path: ~\AppData\Local\Python\bin\python.exe
2026-05-29 00:08:24.516 [info] > pyenv which python
2026-05-29 00:08:24.516 [info] cwd: .
2026-05-29 00:08:28.298 [info] Starting Pylance language server.
Image

Metadata

Metadata

Assignees

Labels

ai-triage-respondedIndicate whether the AI triage agent has responded to this issue.team needs to reproduceIssue has not been reproduced yet

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions