Skip to content

Distutils Deprecation Warning with Python 3.10 and setuptools #5087

@INMOSER84

Description

@INMOSER84

setuptools version

69.1.0

Python version

3.10

OS

ubuntu 22.04

Additional environment information

Instalación de Python desde paquetes del sistema.

Uso de entornos virtuales con venv.

Advertencia solo aparece al ejecutar scripts que importan distutils indirectamente (por ejemplo, GitHub CLI, build de Odoo, etc.).

Description

UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the distutils module in sys.modules.

How to Reproduce

  1. Clone a simple Python project that uses setuptools:
    git clone https://github.com/pypa/sampleproject.git
    cd sampleproject
    
    

Other detail

$ git clone https://github.com/pypa/sampleproject.git
Cloning into 'sampleproject'...
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 12 (delta 2), reused 12 (delta 2), pack-reused 0
Receiving objects: 100% (12/12), 3.45 KiB | 3.45 MiB/s, done.
Resolving deltas: 100% (2/2), done.

$ python3 -m venv venv
$ source venv/bin/activate
$ pip install --upgrade setuptools
Collecting setuptools
Downloading setuptools-69.1.0-py3-none-any.whl (1.1 MB)
Installing collected packages: setuptools
Successfully installed setuptools-69.1.0

$ python setup.py bdist_wheel
/home/user/.local/lib/python3.10/site-packages/_distutils_hack/init.py:15: UserWarning: Distutils was imported before Setuptools, but importing Setuptools also replaces the distutils module in sys.modules. This may lead to undesirable behaviors or errors.
warnings.warn(
running bdist_wheel
running build
running build_py
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssues that need to be evaluated for severity and status.distutils deprecationissues stemming from #4137

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions