Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug] 1.11.0 fails to import on fresh install: bedrock_agentcore.evaluation triggers ModuleNotFoundError: No module named 'requests'

オープン 初心者向け
#496 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
python
領域
build-system

調査の方向性

まずクリーンな仮想環境で再現手順を実行し、その後 pyproject.toml と src/bedrock_agentcore/evaluation/runner/dataset_providers.py、および evaluation entry points にある eager imports を調査します。既存のパッケージ設定に照らして、選択した依存関係または import の挙動を確認します。新規インストール後に requests を手動で追加せず、bedrock_agentcore.evaluation の import が成功すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

[Bug] 1.11.0 fails to import on fresh install: bedrock_agentcore.evaluation triggers ModuleNotFoundError: No module named 'requests'

Summary

After installing bedrock-agentcore==1.11.0 from PyPI into a clean virtual environment, importing anything from bedrock_agentcore.evaluation fails with ModuleNotFoundError: No module named 'requests'. The new file src/bedrock_agentcore/evaluation/runner/dataset_providers.py (added in #491) does import requests at module load, but requests is not declared in the package's runtime dependencies — only in [dependency-groups.dev].

The runtime path (bedrock_agentcore.runtime) is unaffected, so the issue is scoped to the evaluation submodule.

Reproduction

python3.12 -m venv /tmp/repro && source /tmp/repro/bin/activate
pip install bedrock-agentcore==1.11.0
python -c "from bedrock_agentcore.evaluation import EvaluatorInput"

Output:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".../site-packages/bedrock_agentcore/evaluation/__init__.py", line 10, in <module>
    from bedrock_agentcore.evaluation.runner.batch.batch_evaluation_models import (
  File ".../site-packages/bedrock_agentcore/evaluation/runner/__init__.py", line 3, in <module>
    from .dataset_providers import DatasetProvider, FileDatasetProvider
  File ".../site-packages/bedrock_agentcore/evaluation/runner/dataset_providers.py", line 7, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Root cause

In pyproject.toml at v1.11.0, requests only appears in the dev-tools group:

[project]
dependencies = [
    "boto3>=1.43.0",
    "botocore>=1.43.0",
    "pydantic>=2.0.0,<2.41.3",
    "urllib3>=1.26.0",
    "starlette>=0.46.2",
    "typing-extensions>=4.13.2,<5.0.0",
    "uvicorn>=0.34.2",
    "websockets>=12.0",
]   # ← no `requests` here

[dependency-groups]
dev = [
    "httpx>=0.28.1",
    "moto>=5.1.6",          # transitively pulls in requests in dev environments
    ...
]

But src/bedrock_agentcore/evaluation/runner/dataset_providers.py line 7 imports it at the top of the module:

"""Dataset provider implementations for loading evaluation datasets."""

import json
from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional

import requests   # ← runs on module load; runtime dep not declared

from bedrock_agentcore.evaluation.dataset_client import DatasetClient
...

Because evaluation/runner/__init__.py eagerly imports dataset_providers, and evaluation/__init__.py eagerly imports the runner, the failure surfaces on any first-touch of bedrock_agentcore.evaluation.*.

This was masked in CI / local development because moto (a dev-group dep) transitively installs requests, so it's already on the path inside the project's own venv.

Suggested fix

Either of:

Option A — declare the runtime dep

dependencies = [
    ...,
    "requests>=2.31",
]

Option B — make the import lazy (consistent with bedrock_agentcore/identity/auth.py:155, where import requests is already inside a function body)

class FileDatasetProvider(DatasetProvider):
    def fetch(self, url: str) -> ...:
        import requests
        return requests.get(url)

Option B is cleaner if requests is only used by FileDatasetProvider-like loaders — users who never load datasets from a remote URL wouldn't pay the dependency cost.

Environment

  • bedrock-agentcore==1.11.0 (from PyPI, fresh install, no other packages)
  • Python 3.12.12
  • macOS 25.4 / uv 0.11.6 (also reproduces with pip per the steps above)
  • Released 2026-05-22 ~15:27 UTC, no fix on main as of 2026-05-24

Workaround for downstream consumers

Until 1.11.1 ships, downstreams need to either pin bedrock-agentcore<1.11 or declare requests as a direct dep in their own package. We've taken the pin route in our internal eval wheel since we don't yet use any of the new DatasetClient / DatasetManagementServiceProvider symbols added in 1.11.0.

Related

  • PR #491 (the change that introduced the eager top-level import requests)
主要言語
Python
スター
777
フォーク
155
平均マージ
1日 12時間
マージ済み PR(30日)
14

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws/bedrock-agentcore-sdk-python のほかの issue

aws/bedrock-agentcore-sdk-python の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。