mirror of
https://github.com/deepspeedai/DeepSpeed.git
synced 2025-10-20 15:33:51 +08:00
Modernize system executable detection across components (#7290)
# PR Summary This small PR resolves deprecation warnings caused by the use of `distutils.spawn.find_executable`: ```python DeprecationWarning: Use shutil.which instead of find_executable ``` Please note that `find_executable` is deprecated from Python 3.10 and removed in 3.12. `shutil.which` available since Python 3.3. Signed-off-by: Emmanuel Ferdman <emmanuelferdman@gmail.com> Co-authored-by: Olatunji Ruwase <tunji.ruwase@snowflake.com> Co-authored-by: Logan Adams <114770087+loadams@users.noreply.github.com>
This commit is contained in:
@ -9,9 +9,9 @@
|
||||
# ...
|
||||
# ]
|
||||
|
||||
import distutils
|
||||
import os
|
||||
import psutil
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ def check_for_numactl_pkg():
|
||||
found = False
|
||||
for pkgmgr, data in libs.items():
|
||||
flag, lib, tool = data
|
||||
path = distutils.spawn.find_executable(pkgmgr)
|
||||
path = shutil.which(pkgmgr)
|
||||
if path is not None:
|
||||
cmd = [pkgmgr, flag, lib]
|
||||
result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -4,7 +4,7 @@
|
||||
# DeepSpeed Team
|
||||
|
||||
import os
|
||||
import distutils.spawn
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from .builder import TorchCPUOpBuilder
|
||||
@ -82,7 +82,7 @@ class AsyncIOBuilder(TorchCPUOpBuilder):
|
||||
found = False
|
||||
for pkgmgr, data in libs.items():
|
||||
flag, lib, tool = data
|
||||
path = distutils.spawn.find_executable(pkgmgr)
|
||||
path = shutil.which(pkgmgr)
|
||||
if path is not None:
|
||||
cmd = [pkgmgr, flag, lib]
|
||||
result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
# DeepSpeed Team
|
||||
|
||||
import distutils.spawn
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from .builder import CPUOpBuilder
|
||||
@ -60,7 +60,7 @@ class AsyncIOBuilder(CPUOpBuilder):
|
||||
found = False
|
||||
for pkgmgr, data in libs.items():
|
||||
flag, lib, tool = data
|
||||
path = distutils.spawn.find_executable(pkgmgr)
|
||||
path = shutil.which(pkgmgr)
|
||||
if path is not None:
|
||||
cmd = [pkgmgr, flag, lib]
|
||||
result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
# DeepSpeed Team
|
||||
|
||||
import distutils.spawn
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from .builder import NPUOpBuilder
|
||||
@ -72,7 +72,7 @@ class AsyncIOBuilder(NPUOpBuilder):
|
||||
found = False
|
||||
for pkgmgr, data in libs.items():
|
||||
flag, lib, tool = data
|
||||
path = distutils.spawn.find_executable(pkgmgr)
|
||||
path = shutil.which(pkgmgr)
|
||||
if path is not None:
|
||||
cmd = [pkgmgr, flag, lib]
|
||||
result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
# DeepSpeed Team
|
||||
|
||||
import distutils.spawn
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
from .builder import OpBuilder
|
||||
@ -75,7 +75,7 @@ class AsyncIOBuilder(OpBuilder):
|
||||
found = False
|
||||
for pkgmgr, data in libs.items():
|
||||
flag, lib, tool = data
|
||||
path = distutils.spawn.find_executable(pkgmgr)
|
||||
path = shutil.which(pkgmgr)
|
||||
if path is not None:
|
||||
cmd = [pkgmgr, flag, lib]
|
||||
result = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
Reference in New Issue
Block a user