Fix deprecation warning for pkg_resources dependency by changing to packaging (#13643)
* Add `packaging` dependency * Change to use `packaging` dependency * Auto-format by https://ultralytics.com/actions --------- Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
1 parent
567c66463e
commit
7071317958
3 files changed
+4
-2
No files matched your search
+2
-2
@@ -28,8 +28,8 @@ from zipfile import ZipFile, is_zipfile
|
||||
|
||||
import cv2
|
||||
import numpy as np
|
||||
import packaging
|
||||
import pandas as pd
|
||||
import pkg_resources as pkg
|
||||
import torch
|
||||
import torchvision
|
||||
import yaml
|
||||
@@ -425,7 +425,7 @@ def check_python(minimum="3.8.0"):
|
||||
|
||||
def check_version(current="0.0.0", minimum="0.0.0", name="version ", pinned=False, hard=False, verbose=False):
|
||||
"""Checks if the current version meets the minimum required version, exits or warns based on parameters."""
|
||||
current, minimum = (pkg.parse_version(x) for x in (current, minimum))
|
||||
current, minimum = (packaging.version.parse(x) for x in (current, minimum))
|
||||
result = (current == minimum) if pinned else (current >= minimum) # bool
|
||||
s = f"WARNING ⚠️ {name}{minimum} is required by YOLOv5, but {name}{current} is currently installed" # string
|
||||
if hard:
|
||||
|
||||
Reference in new issue
Block a user