Cannot create temporary file name
dt99jay opened this issue · 1 comments
I'm seeing the below error and am not sure if it's raised by RTree or libspatialindex. I'm using RTree via the Trimesh library, and only see the error when processing larger meshes. The code is running in an AWS Lambda function and looks to be related to temp file creation, so I wonder if it's necessary/possible to customise the location in which RTree or libspatialindex tries to create temp files. Grateful for any pointers.
(I'm using the linux-64/libspatialindex-1.9.3-he1b5a44_3
binary of libspatialindex from conda-forge.)
[ERROR] RTreeError: Error in "Index_CreateWithStream": Tools::TemporaryFile: Cannot create temporary file name.: iostream error
Traceback (most recent call last):
File "/var/task/lambda_function.py", line 174, in lambda_handler
coords_bottom = gen_coords_bottom(coords, coords_top, tris)
File "/var/task/lambda_function.py", line 74, in gen_coords_bottom
coords_bottom, index_ray, index_tri = surface.ray.intersects_location(
File "/opt/python/trimesh/ray/ray_triangle.py", line 103, in intersects_location
locations) = self.intersects_id(
File "/opt/python/trimesh/ray/ray_triangle.py", line 64, in intersects_id
tree=self.mesh.triangles_tree,
File "/opt/python/trimesh/caching.py", line 100, in get_cached
value = function(*args, **kwargs)
File "/opt/python/trimesh/base.py", line 824, in triangles_tree
tree = triangles.bounds_tree(self.triangles)
File "/opt/python/trimesh/triangles.py", line 344, in bounds_tree
tree = util.bounds_tree(triangle_bounds)
File "/opt/python/trimesh/util.py", line 1811, in bounds_tree
tree = rtree.index.Index(zip(np.arange(len(bounds)),
File "/opt/python/rtree/index.py", line 282, in __init__
self.handle = self._create_idx_from_stream(stream)
File "/opt/python/rtree/index.py", line 1079, in _create_idx_from_stream
return IndexStreamHandle(self.properties.handle, stream)
File "/opt/python/rtree/index.py", line 1209, in __init__
self._ptr = self._create(*args, **kwargs)
File "/opt/python/rtree/core.py", line 25, in check_void
raise RTreeError(msg)
Closing this as I see you can pass a specific filename to rtree.index.Index()
. Patching Trimesh's bounds_tree()
to save the file to /tmp/filename
seems to allow temp files to be created on a Lambda.