FROM ubuntu:lunar-20230615 and `lap` install fixes (#3374)

single_channel
Glenn Jocher 1 year ago committed by GitHub
parent ca2c8774d8
commit 9b00d37022
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,7 +3,7 @@
# Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv8 deployments # Image is CPU-optimized for ONNX, OpenVINO and PyTorch YOLOv8 deployments
# Start FROM Ubuntu image https://hub.docker.com/_/ubuntu # Start FROM Ubuntu image https://hub.docker.com/_/ubuntu
FROM ubuntu:22.10 FROM ubuntu:lunar-20230615
# Downloads to user config dir # Downloads to user config dir
ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Arial.Unicode.ttf /root/.config/Ultralytics/
@ -23,6 +23,9 @@ WORKDIR /usr/src/ultralytics
RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics RUN git clone https://github.com/ultralytics/ultralytics /usr/src/ultralytics
ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /usr/src/ultralytics/
# Remove python3.11/EXTERNALLY-MANAGED or use 'pip install --break-system-packages' avoid 'externally-managed-environment' Ubuntu nightly error
RUN rm -rf /usr/lib/python3.11/EXTERNALLY-MANAGED
# Install pip packages # Install pip packages
RUN python3 -m pip install --upgrade pip wheel RUN python3 -m pip install --upgrade pip wheel
RUN pip install --no-cache -e . thop --extra-index-url https://download.pytorch.org/whl/cpu RUN pip install --no-cache -e . thop --extra-index-url https://download.pytorch.org/whl/cpu

@ -13,7 +13,8 @@ try:
except (ImportError, AssertionError, AttributeError): except (ImportError, AssertionError, AttributeError):
from ultralytics.yolo.utils.checks import check_requirements from ultralytics.yolo.utils.checks import check_requirements
check_requirements('lap>=0.4') # install check_requirements('cython') # required before installing lap from source
check_requirements('git+https://github.com/gatagat/lap.git') # more reliable than 'pip install lap'
import lap import lap

@ -222,12 +222,13 @@ def check_requirements(requirements=ROOT.parent / 'requirements.txt', exclude=()
s = '' # console string s = '' # console string
n = 0 # number of packages updates n = 0 # number of packages updates
for r in requirements: for r in requirements:
rmin = r.split('/')[-1].replace('.git', '') # replace git+https://org/repo.git -> 'repo'
try: try:
pkg.require(r) pkg.require(rmin)
except (pkg.VersionConflict, pkg.DistributionNotFound): # exception if requirements not met except (pkg.VersionConflict, pkg.DistributionNotFound): # exception if requirements not met
try: # attempt to import (slower but more accurate) try: # attempt to import (slower but more accurate)
import importlib import importlib
importlib.import_module(next(pkg.parse_requirements(r)).name) importlib.import_module(next(pkg.parse_requirements(rmin)).name)
except ImportError: except ImportError:
s += f'"{r}" ' s += f'"{r}" '
n += 1 n += 1

Loading…
Cancel
Save