Skip to content

Commit

Permalink
skip triangle requirement on arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
AdeelH committed Mar 29, 2024
1 parent bd428b5 commit 7b679e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ RUN --mount=type=cache,target=/root/.cache/pip cat pytorch-requirements.txt | so
COPY ./rastervision_aws_batch/requirements.txt /opt/src/batch-requirements.txt
COPY ./rastervision_aws_s3/requirements.txt /opt/src/s3-requirements.txt
COPY ./rastervision_core/requirements.txt /opt/src/core-requirements.txt

# Pip wheels for triangle are missing for ARM64 architectures and building
# from source fails, so we skip it.
RUN if [ "${TARGETARCH}" = "arm64" ]; \
then sed -i '/^triangle.*$/d' /opt/src/core-requirements.txt; fi

COPY ./rastervision_gdal_vsi/requirements.txt /opt/src/gdal-requirements.txt
COPY ./rastervision_pipeline/requirements.txt /opt/src/pipeline-requirements.txt
COPY ./rastervision_aws_sagemaker/requirements.txt /opt/src/sagemaker-requirements.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import numpy as np
from shapely.geometry import Polygon, MultiPolygon, LinearRing
from shapely.ops import unary_union
from triangle import triangulate


class AoiSampler():
Expand Down Expand Up @@ -67,6 +66,8 @@ def triangulate_polygon(self, polygon: Polygon) -> dict:
"""Extract vertices and edges from the polygon (and its holes, if any)
and pass them to the Triangle library for triangulation.
"""
from triangle import triangulate

vertices, edges = self.polygon_to_graph(polygon)

holes = polygon.interiors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ def __init__(self,
p.intersection(extent_polygon) for p in self.aoi_polygons
]
if efficient_aoi_sampling:
self.aoi_sampler = AoiSampler(self.aoi_polygons)
try:
self.aoi_sampler = AoiSampler(self.aoi_polygons)
except ModuleNotFoundError:
log.info('Ignoring efficient_aoi_sampling since triangle '
'is not installed.')

def get_resize_transform(
self, transform: Optional[A.BasicTransform],
Expand Down

0 comments on commit 7b679e6

Please sign in to comment.