[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
[Bug] 1.11.0 fails to import on fresh install:
bedrock_agentcore.evaluationtriggersModuleNotFoundError: No module named 'requests'Summary
After installing
bedrock-agentcore==1.11.0from PyPI into a clean virtual environment, importing anything frombedrock_agentcore.evaluationfails withModuleNotFoundError: No module named 'requests'. The new filesrc/bedrock_agentcore/evaluation/runner/dataset_providers.py(added in #491) doesimport requestsat module load, butrequestsis 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
Output:
Root cause
In
pyproject.tomlatv1.11.0,requestsonly appears in the dev-tools group:But
src/bedrock_agentcore/evaluation/runner/dataset_providers.pyline 7 imports it at the top of the module:Because
evaluation/runner/__init__.pyeagerly importsdataset_providers, andevaluation/__init__.pyeagerly imports the runner, the failure surfaces on any first-touch ofbedrock_agentcore.evaluation.*.This was masked in CI / local development because
moto(a dev-group dep) transitively installsrequests, so it's already on the path inside the project's own venv.Suggested fix
Either of:
Option A — declare the runtime dep
Option B — make the import lazy (consistent with
bedrock_agentcore/identity/auth.py:155, whereimport requestsis already inside a function body)Option B is cleaner if
requestsis only used byFileDatasetProvider-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)uv0.11.6 (also reproduces withpipper the steps above)mainas of 2026-05-24Workaround for downstream consumers
Until 1.11.1 ships, downstreams need to either pin
bedrock-agentcore<1.11or declarerequestsas 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 newDatasetClient/DatasetManagementServiceProvidersymbols added in 1.11.0.Related
import requests)