Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1950229

Summary: dnf with Python 3.10: DeprecationWarning: The distutils package is deprecated
Product: [Fedora] Fedora Reporter: Lumír Balhar <lbalhar>
Component: dnfAssignee: amatej
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: amatej, dmach, jmracek, jrohel, mblaha, mhatina, packaging-team-maint, pkratoch, ppisar, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dnf-4.8.0-1.fc35 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-15 07:21:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lumír Balhar 2021-04-16 07:11:50 UTC
Description of problem:
Python 3.10 will be the main Python interpreter in Fedora 35 and the distutils module is deprecated there and raises DeprecationWarning when imported.

Version-Release number of selected component (if applicable):
  Installed: dnf-0:4.7.0-1.fc35.noarch at Fri Apr 16 06:16:27 2021
  Built    :  at Thu Apr 15 15:19:35 2021

  Installed: rpm-0:4.16.1.3-1.fc35.x86_64 at Wed Apr  7 08:13:20 2021
  Built    : Fedora Project at Mon Mar 22 10:34:04 2021

Python 3.10.0a7

How reproducible:
Always

Steps to Reproduce:
1. run whatever dnf command, dnf --version for example

Actual results:
# dnf --version
/usr/lib/python3.10/site-packages/dnf/const.py:22: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  import distutils.sysconfig
4.7.0
  Installed: dnf-0:4.7.0-1.fc35.noarch at Fri Apr 16 06:16:27 2021
  Built    :  at Thu Apr 15 15:19:35 2021

  Installed: rpm-0:4.16.1.3-1.fc35.x86_64 at Wed Apr  7 08:13:20 2021
  Built    : Fedora Project at Mon Mar 22 10:34:04 2021

Expected results:
No raised warning.

Additional info:
This import is unused: https://github.com/rpm-software-management/dnf/blob/1e0b9221006ec83cd8d359fc1a7d847e3443dfa2/dnf/persistor.py#L29

Comment 1 amatej 2021-04-19 13:22:23 UTC
Thank you for reporting this!
I made a PR which should fix it: https://github.com/rpm-software-management/dnf/pull/1758

Comment 2 Fedora Update System 2021-06-15 07:21:34 UTC
FEDORA-2021-78c5f8c03d has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.