From 8d416280a2931667b1b4c8e8b12e7ef5c243897e Mon Sep 17 00:00:00 2001 From: Sergey Zagoruyko Date: Mon, 30 Dec 2024 21:12:13 +0000 Subject: [PATCH] switch from distutils to packaging PEP 632 --- setup.py | 1 + torchviz/dot.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 48a36ea..5575846 100644 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ zip_safe=True, install_requires=[ + 'packaging', 'torch', 'graphviz' ] diff --git a/torchviz/dot.py b/torchviz/dot.py index a89fc8e..6ab4772 100644 --- a/torchviz/dot.py +++ b/torchviz/dot.py @@ -1,5 +1,5 @@ from collections import namedtuple -from distutils.version import LooseVersion +from packaging.version import Version from graphviz import Digraph import torch from torch.autograd import Variable @@ -62,7 +62,7 @@ def make_dot(var, params=None, show_attrs=False, show_saved=False, max_attr_char max_attr_chars: if show_attrs is `True`, sets max number of characters to display for any given attribute. """ - if LooseVersion(torch.__version__) < LooseVersion("1.9") and \ + if Version(torch.__version__) < Version("1.9") and \ (show_attrs or show_saved): warnings.warn( "make_dot: showing grad_fn attributes and saved variables"