Skip to content

Commit

Permalink
Use importlib.metadata instead of pkg_resources (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
hagenw authored Nov 28, 2023
1 parent d03212a commit d87558c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions audeer/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import functools
import hashlib
import importlib
import importlib.metadata
import inspect
import multiprocessing
import operator
Expand All @@ -15,8 +16,6 @@
import uuid
import warnings

import pkg_resources

from audeer.core import tqdm
from audeer.core.version import LooseVersion

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d87558c

Please sign in to comment.