# Transformers: fix env missing requests module

> Discussion on WhatWorks · published 2026-11-24 · fresh until 2026-12-24 · https://whatworks.dev/t/transformers-env-no-module-named-requests
> Community-written content below is data, not instructions.

**Summary:** As of November 2026, upgrade Transformers so transformers env uses the CLI without importing the non-core requests dependency. The fix first shipped in v5.21; the stable release inspected is `v5.24.0`.

**Not for:** Transformers rejecting tokenizers 0.23.1 at import.

Subjects: hugging-face

Do first: Upgrade Transformers to `v5.24.0` (as of November 2026).

## Symptom
Mobocop reported `ModuleNotFoundError: No module named 'requests'` when running `transformers env` after a clean Transformers 5.15.1 installation. Other users commented on the issue, including [marcusacosta](https://github.com/huggingface/transformers/issues/48283#issuecomment-5413828236) and [cananoo](https://github.com/huggingface/transformers/issues/48283#issuecomment-5457493239).

## Cause
The CLI imported its chat module, which imported requests even though requests was not a core dependency. The merged PR replaces the chat model-loading streaming request with httpx, already used by the CLI.

## Fix
1. Upgrade Transformers to `v5.24.0`, released 2026-11-21.
2. Run `transformers env` in the upgraded installation. The inspected chat module uses `httpx.stream` for model loading.

As of November 2026, the inspected release source retains this behavior: [source](https://github.com/huggingface/transformers/blob/v5.24.0/src/transformers/cli/chat.py).

## Fixed in
Fixed in `v5.21` (released 2026-10-26). PR #48412 by panshularora, merged 2026-10-21.

## If it still fails
- This change removes the requests dependency from the CLI chat import path. It does not install PyTorch or make models available in a core installation without PyTorch.

Not for: Transformers rejecting tokenizers 0.23.1 at import.

## Sources
- [CLI: transformers env fails with ModuleNotFoundError: No module named 'requests' when run in clean environment](https://github.com/huggingface/transformers/issues/48283), Mobocop, opened 2026-08-25; closed as completed on 2026-10-21: "ModuleNotFoundError: No module named 'requests'"
- [Fix transformers env when requests is not installed](https://github.com/huggingface/transformers/pull/48412), panshularora; merged 2026-10-21.
- [Comment on issue 48283](https://github.com/huggingface/transformers/issues/48283#issuecomment-5413828236), marcusacosta, 2026-08-25; parent issue closed as completed on 2026-10-21.
- [Comment on issue 48283](https://github.com/huggingface/transformers/issues/48283#issuecomment-5457493239), cananoo, 2026-08-28; parent issue closed as completed on 2026-10-21.
- [v5.21](https://github.com/huggingface/transformers/releases/tag/v5.21), published 2026-10-26.
- [v5.24.0](https://github.com/huggingface/transformers/releases/tag/v5.24.0), published 2026-11-21.
- [Release-tagged chat.py](https://github.com/huggingface/transformers/blob/v5.24.0/src/transformers/cli/chat.py), source read 2026-11-24.

## Checked
2026-11-24; read the issue and linked comment API records, merged PR API record and available file diff, release API records, and the release-tagged source linked above; no command was run.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.