Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Environment:Huggingface Transformers Python 310 Runtime

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Runtime
Last Updated 2026-02-13 20:00 GMT

Overview

Python 3.10+ runtime environment required for the Huggingface Transformers library (v5.x).

Description

Transformers v5.x requires Python 3.10 or higher (up to 3.14). The library uses modern Python features including type union syntax (|), match statements, and structural pattern matching that are only available in Python 3.10+. The hard dependencies include huggingface-hub, numpy, packaging, pyyaml, regex, tokenizers, safetensors, tqdm, and typer-slim.

Usage

This is the base runtime environment required for any use of the Transformers library. All workflows (Pipeline Inference, Model Training, Quantization, PEFT, Distributed Training, Benchmarking) require this environment as a prerequisite.

System Requirements

Category Requirement Notes
OS Linux, macOS, or Windows OS Independent per classifier
Python >= 3.10.0, <= 3.14.x Supported range: 3.10 to 3.14
Disk ~500MB For base library + dependencies

Dependencies

System Packages

  • No system-level packages required for base installation

Python Packages (Hard Dependencies)

  • huggingface-hub >= 1.3.0, < 2.0
  • numpy >= 1.17
  • packaging >= 20.0
  • pyyaml >= 5.1
  • regex != 2019.12.17
  • tokenizers >= 0.22.0, <= 0.23.0
  • safetensors >= 0.4.3
  • tqdm >= 4.27
  • typer-slim (CLI utilities)

Optional Extras

  • transformers[torch]: torch >= 2.4, accelerate >= 1.1.0
  • transformers[vision]: torchvision, Pillow >= 10.0.1
  • transformers[audio]: torchaudio, librosa, pyctcdecode, phonemizer
  • transformers[video]: av
  • transformers[sentencepiece]: sentencepiece >= 0.1.91, protobuf
  • transformers[accelerate]: accelerate >= 1.1.0
  • transformers[serving]: openai, pydantic, uvicorn, fastapi, starlette, rich

Credentials

No credentials required for the base installation. Some workflows require:

  • HF_TOKEN: HuggingFace API token for accessing gated models on the Hub.

Quick Install

# Base installation
pip install transformers

# With PyTorch support (most common)
pip install transformers[torch]

# Full installation with all modalities
pip install transformers[all]

Code Evidence

Python version requirement from setup.py:51:

# Supported Python version range (min, max)
SUPPORTED_PYTHON_VERSIONS = (10, 14)  # 3.10 to 3.14

Hard dependency list from setup.py:264-274:

install_requires = [
    deps["huggingface-hub"],
    deps["numpy"],
    deps["packaging"],
    deps["pyyaml"],
    deps["regex"],
    deps["tokenizers"],
    deps["typer-slim"],
    deps["safetensors"],
    deps["tqdm"],
]

Common Errors

Error Message Cause Solution
Python >= 3.10 is required Python version too old Upgrade to Python 3.10+
ImportError: cannot import name 'transformers' Package not installed pip install transformers
tokenizers version mismatch Incompatible tokenizers version pip install tokenizers>=0.22.0,<=0.23.0

Compatibility Notes

  • Python 3.13+: The kenlm package (for audio extras) is not available on Python 3.13+.
  • Python 3.14+: The mistral-common, ray[tune], and sudachipy extras are not available.
  • All Platforms: OS Independent; tested on Linux, macOS, and Windows.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment