[GH-ISSUE #829] Missing disutils, specifically for Python3.12 envs #178

Closed
opened 2026-03-02 15:56:26 +03:00 by kerem · 0 comments
Owner

Originally created by @minhduc304 on GitHub (May 5, 2025).
Original GitHub issue: https://github.com/probberechts/soccerdata/issues/829

Describe the bug
Python 3.12 does not come with a stdlib distutils module (changelog), because distutils was deprecated in 3.10 and removed in 3.12.

Code example
This would fail for python3.12 users.

import soccerdata as sd
fbref = sd.FBref(leagues="ENG-Premier League", seasons="24/25", no_cache=True)
fbref.read_schedule()

Error message

ModuleNotFoundError: No module named 'distutils'. 

**Contributor Action
I can fix this issue and will submit a pull request.
We can either:

  • explicitly include setup tools
[build-system]
requires = ["poetry-core>=1.0.0", "setuptools"]
build-backend = "poetry.core.masonry.api"
  • fail with clear error
# soccerdata/__init__.py
import sys

if sys.version_info >= (3, 12):
    try:
        import setuptools  # noqa: F401
    except ImportError:
        raise RuntimeError(
            "Python 3.12 requires setuptools to be installed manually. "
            "Please run: python -m pip install setuptools"
        )
Originally created by @minhduc304 on GitHub (May 5, 2025). Original GitHub issue: https://github.com/probberechts/soccerdata/issues/829 **Describe the bug** Python 3.12 does not come with a stdlib distutils module (changelog), because distutils was deprecated in 3.10 and removed in 3.12. **Code example** This would fail for python3.12 users. ```python import soccerdata as sd fbref = sd.FBref(leagues="ENG-Premier League", seasons="24/25", no_cache=True) fbref.read_schedule() ``` **Error message** ``` ModuleNotFoundError: No module named 'distutils'. ``` **Contributor Action I can fix this issue and will submit a pull request. We can either: - [ ] explicitly include setup tools ``` [build-system] requires = ["poetry-core>=1.0.0", "setuptools"] build-backend = "poetry.core.masonry.api" ``` - [ ] fail with clear error ``` # soccerdata/__init__.py import sys if sys.version_info >= (3, 12): try: import setuptools # noqa: F401 except ImportError: raise RuntimeError( "Python 3.12 requires setuptools to be installed manually. " "Please run: python -m pip install setuptools" ) ```
kerem 2026-03-02 15:56:26 +03:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/soccerdata#178
No description provided.