diff --git a/dockers/base-cuda/Dockerfile b/dockers/base-cuda/Dockerfile index 9153fd33ebef5..0e5268d311054 100644 --- a/dockers/base-cuda/Dockerfile +++ b/dockers/base-cuda/Dockerfile @@ -59,7 +59,7 @@ RUN \ add-apt-repository ppa:deadsnakes/ppa && \ apt-get install -y \ python${PYTHON_VERSION} \ - python${PYTHON_VERSION}-distutils \ + python3-setuptools \ python${PYTHON_VERSION}-dev \ && \ update-alternatives --install /usr/bin/python${PYTHON_VERSION%%.*} python${PYTHON_VERSION%%.*} /usr/bin/python${PYTHON_VERSION} 1 && \ diff --git a/dockers/docs/Dockerfile b/dockers/docs/Dockerfile index 46882c2dc50bf..ec590bf182ee2 100644 --- a/dockers/docs/Dockerfile +++ b/dockers/docs/Dockerfile @@ -44,7 +44,7 @@ RUN \ dvipng \ texlive-pictures \ python3 \ - python3-distutils \ + python3-setuptools \ python3-dev \ && \ update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \ diff --git a/examples/fabric/reinforcement_learning/rl/utils.py b/examples/fabric/reinforcement_learning/rl/utils.py index 7585eda616ee4..4c5a8066b359f 100644 --- a/examples/fabric/reinforcement_learning/rl/utils.py +++ b/examples/fabric/reinforcement_learning/rl/utils.py @@ -1,7 +1,6 @@ import argparse import math import os -from distutils.util import strtobool from typing import TYPE_CHECKING, Optional, Union import gymnasium as gym @@ -12,6 +11,23 @@ from rl.agent import PPOAgent, PPOLightningAgent +def strtobool(val): + """Convert a string representation of truth to true (1) or false (0). + + True values are 'y', 'yes', 't', 'true', 'on', and '1'; false values are 'n', 'no', 'f', 'false', 'off', and '0'. + Raises ValueError if 'val' is anything else. + + Note: taken from distutils after its deprecation. + + """ + val = val.lower() + if val in ("y", "yes", "t", "true", "on", "1"): + return 1 + if val in ("n", "no", "f", "false", "off", "0"): + return 0 + raise ValueError(f"invalid truth value {val!r}") + + def parse_args(): parser = argparse.ArgumentParser() parser.add_argument("--exp-name", type=str, default="default", help="the name of this experiment")