Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use importlib.metadata instead of pkg_resources #122

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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