From d87558c272402e9c397b65bcaf7c29e999beb166 Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Tue, 28 Nov 2023 14:55:43 +0100 Subject: [PATCH] Use importlib.metadata instead of pkg_resources (#122) --- audeer/core/utils.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/audeer/core/utils.py b/audeer/core/utils.py index 79cdc79..008db67 100644 --- a/audeer/core/utils.py +++ b/audeer/core/utils.py @@ -4,6 +4,7 @@ import functools import hashlib import importlib +import importlib.metadata import inspect import multiprocessing import operator @@ -15,8 +16,6 @@ import uuid import warnings -import pkg_resources - from audeer.core import tqdm from audeer.core.version import LooseVersion @@ -374,8 +373,8 @@ def install_package( # raise error if package is already installed # and does not satisfy requested version try: - current_version = pkg_resources.get_distribution(name).version - except pkg_resources.DistributionNotFound: + current_version = importlib.metadata.version(name) + except importlib.metadata.PackageNotFoundError: current_version = None if current_version is not None: