DeprecationWarning when running worlddump.py

Bug #2009229 reported by Melvin Seddig
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
devstack
Fix Released
Low
Martin Kopec

Bug Description

stack.sh output on Ubuntu 22.04.2 and 22.10:

++functions-common:apt_get:1228 result=0
++functions-common:apt_get:1231 time_stop apt-get
++functions-common:time_stop:2433 local name
++functions-common:time_stop:2434 local end_time
++functions-common:time_stop:2435 local elapsed_time
++functions-common:time_stop:2436 local total
++functions-common:time_stop:2437 local start_time
++functions-common:time_stop:2439 name=apt-get
++functions-common:time_stop:2440 start_time=1677877255889
++functions-common:time_stop:2442 [[ -z 1677877255889 ]]
+++functions-common:time_stop:2445 date +%s%3N
++functions-common:time_stop:2445 end_time=1677877258921
++functions-common:time_stop:2446 elapsed_time=3032
++functions-common:time_stop:2447 total=414
++functions-common:time_stop:2449 _TIME_START[$name]=
++functions-common:time_stop:2450 _TIME_TOTAL[$name]=3446
++functions-common:apt_get:1232 return 0
++tools/install_prereqs.sh:source:74 [[ -n False ]]
++tools/install_prereqs.sh:source:74 [[ False != \F\a\l\s\e ]]
++tools/install_prereqs.sh:source:88 date +%s
++tools/install_prereqs.sh:source:89 date
+./stack.sh:main:801 [[ False != \T\r\u\e ]]
+./stack.sh:main:802 PYPI_ALTERNATIVE_URL=
+./stack.sh:main:802 /opt/stack/devstack/tools/install_pip.sh
/opt/stack/devstack/.localrc.auto: line 2: 2a01:4f8:120:632c:4664::0/48: No such file or directory
++./stack.sh:main:802 err_trap
++./stack.sh:err_trap:802 local r=127
++./stack.sh:err_trap:802 set +o xtrace
stack.sh failed
Error on exit
/opt/stack/devstack/tools/worlddump.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
  from distutils import spawn
World dumping... see /opt/stack/logs/worlddump-2023-03-03-210059.txt for details

-----------------------------------
Release: on 2022-08-05 14:18:13
SHA: 4801a257430cea6a8bb6e7c05af0a7e99aaee78e
Source: https://opendev.org/openstack-dev/devstack/src/doc/source/index.rst
URL: https://docs.openstack.org/devstack/latest/

Revision history for this message
Melvin Seddig (therideru) wrote (last edit ):

I tried adding the "import setuptools" in the /opt/stack/devstack/tools/worlddump.py on line 22 and remove the distutils.

But now I get an error that "spawn" is not defined.

Revision history for this message
Melvin Seddig (therideru) wrote :

I fixed the issue by adding

"
import setuptools
from distutils import spawn
"

that fixed it and my openstack platfrom comes online.

Revision history for this message
Dr. Jens Harbott (j-harbott) wrote :

worlddump.py is only executed when stack.sh has only failed, the original error seems to have been some other issue in your local.conf file.

Still, we should fix that DeprecationWarning going forward to avoid confusion and to be ready for Python 3.12 whenever that may hit distros.

Changed in devstack:
status: New → Triaged
importance: Undecided → Low
summary: - DevStack error with distutils in pyton
+ DeprecationWarning when running worlddump.py
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to devstack (master)

Fix proposed to branch: master
Review: https://review.opendev.org/c/openstack/devstack/+/884485

Changed in devstack:
status: Triaged → In Progress
Martin Kopec (mkopec)
Changed in devstack:
assignee: nobody → Martin Kopec (mkopec)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to devstack (master)

Reviewed: https://review.opendev.org/c/openstack/devstack/+/884485
Committed: https://opendev.org/openstack/devstack/commit/a37b6abc8ecab1a32593aecdf8f74d54f3c4adb1
Submitter: "Zuul (22348)"
Branch: master

commit a37b6abc8ecab1a32593aecdf8f74d54f3c4adb1
Author: Martin Kopec <email address hidden>
Date: Fri May 26 13:46:42 2023 +0200

    Resolve distutils deprecation warning

    The distutils package is deprecated and slated for removal in
    Python 3.12. Let's use shutil.which which is also recomended
    by PEP 632: https://peps.python.org/pep-0632/#migration-advice

    Closes-Bug: #2009229
    Change-Id: Ibb2a9731449e765c4a56952a9f02679e9618778b

Changed in devstack:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.