diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 63eb19630de9..82861e12f8ef 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -128,11 +128,12 @@ jobs: if: ${{ matrix.os == 'ubuntu-latest' }} run: | # 2) mnist_with_visdom.py - python -c "from visdom.server.build import download_scripts; download_scripts()" # download scripts : https://github.com/facebookresearch/visdom/blob/master/py/server.py#L929 - python -m visdom.server & - sleep 10 - python examples/mnist/mnist_with_visdom.py --epochs=1 - kill %1 + # Visdom is unmaintained and cannot be installed with modern packages + # python -c "from visdom.server.build import download_scripts; download_scripts()" # download scripts : https://github.com/facebookresearch/visdom/blob/master/py/server.py#L929 + # python -m visdom.server & + # sleep 10 + # python examples/mnist/mnist_with_visdom.py --epochs=1 + # kill %1 # 3.1) mnist_with_tensorboard.py with tbX python examples/mnist/mnist_with_tensorboard.py --epochs=1 # 3.2) mnist_with_tensorboard.py with native torch tb diff --git a/ignite/contrib/engines/common.py b/ignite/contrib/engines/common.py index 68548f51826b..ed3ae5ff4eb2 100644 --- a/ignite/contrib/engines/common.py +++ b/ignite/contrib/engines/common.py @@ -384,6 +384,11 @@ def setup_visdom_logging( - Learning rate(s) - Evaluation metrics + .. warning:: + + This function uses VisdomLogger which is currently untested due to the visdom package being + unmaintained and difficult to install with modern Python packages. Use at your own risk. + Args: trainer: trainer engine optimizers: single or dictionary of diff --git a/ignite/handlers/visdom_logger.py b/ignite/handlers/visdom_logger.py index 8ca45d9dec5d..642e8fd0e7a5 100644 --- a/ignite/handlers/visdom_logger.py +++ b/ignite/handlers/visdom_logger.py @@ -30,6 +30,11 @@ class VisdomLogger(BaseLogger): """ VisdomLogger handler to log metrics, model/optimizer parameters, gradients during the training and validation. + .. warning:: + + This logger is currently untested due to the visdom package being unmaintained and difficult to install + with modern Python packages. Use at your own risk. + This class requires `visdom `_ package to be installed: .. code-block:: bash @@ -156,7 +161,7 @@ def __init__( **kwargs: Any, ): try: - import visdom + import visdom # pyrefly: ignore except ImportError: raise ModuleNotFoundError( "This contrib module requires visdom package. " diff --git a/requirements-dev.txt b/requirements-dev.txt index ae66183dae01..8b6189efefcd 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -17,7 +17,7 @@ tqdm scikit-learn matplotlib tensorboardX -visdom +# visdom # Removed: unmaintained package, cannot be installed with modern packages polyaxon wandb mlflow @@ -27,6 +27,8 @@ torchvision pynvml<12 # pynvml module was removed in 12.X, is not developed or maintained. We should replace pynvml with something else. clearml scikit-image +# TODO: py-rouge is very old package and its code should vendored into our rouge tests and finally remove py-rouge dependency +setuptools<82 py-rouge pycocotools # temporary fix for python=3.12 and v3.8.1 diff --git a/tests/ignite/contrib/engines/test_common.py b/tests/ignite/contrib/engines/test_common.py index e14042e62c15..f4ce951b7743 100644 --- a/tests/ignite/contrib/engines/test_common.py +++ b/tests/ignite/contrib/engines/test_common.py @@ -505,6 +505,7 @@ def test_setup_tb_logging(dirname): @pytest.mark.skipif(sys.platform.startswith("win"), reason="Skip on Windows") +@pytest.mark.skip(reason="Visdom is unmaintained and cannot be installed with modern packages") def test_setup_visdom_logging(visdom_offline_logfile): vis_logger = _test_setup_logging( setup_logging_fn=setup_visdom_logging, diff --git a/tests/ignite/handlers/conftest.py b/tests/ignite/handlers/conftest.py index 79ac0809698e..3a65b7ac68bf 100644 --- a/tests/ignite/handlers/conftest.py +++ b/tests/ignite/handlers/conftest.py @@ -5,13 +5,15 @@ import pytest import torch -from visdom import Visdom -from visdom.server.build import download_scripts @pytest.fixture(scope="session") def visdom_server(): # Start Visdom server once and stop it with visdom_server_stop + + from visdom import Visdom + from visdom.server.build import download_scripts + vd_hostname = "localhost" if not (Path.home() / ".visdom").exists(): (Path.home() / ".visdom").mkdir(exist_ok=True) diff --git a/tests/ignite/handlers/test_visdom_logger.py b/tests/ignite/handlers/test_visdom_logger.py index 826f63c95f3f..b7e07b74a8c7 100644 --- a/tests/ignite/handlers/test_visdom_logger.py +++ b/tests/ignite/handlers/test_visdom_logger.py @@ -16,9 +16,12 @@ WeightsScalarHandler, ) -# Run tests on a single worker to avoid issues with connecting to the visdom -# server This requires that the --dist=loadgroup option be passed to pytest. -pytestmark = [pytest.mark.timeout(30), pytest.mark.xdist_group(name="visdom")] +# Skip all tests in this module: visdom is unmaintained and cannot be installed with modern packages +pytestmark = [ + pytest.mark.skip(reason="Visdom is unmaintained and cannot be installed with modern packages"), + pytest.mark.timeout(30), + pytest.mark.xdist_group(name="visdom"), +] def test_optimizer_params_handler_wrong_setup():