Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

Pointcloud.translate() crashes programm if used with numpy >2.0

Open omagjhreblin opened this issue 1 year ago • 1 comments

Checklist

Describe the issue

I installed open3d via pip and i was installed with numpy 2.1.0. When running the code the translation will silenty crash my python programm. Downgrading to numpy <2.0 resolves the issuse. If I use the latest dev-wheel it works fine, because the numpy version is <2.0.

Steps to reproduce the bug

import open3d as o3d
import numpy as np
import copy


def main():
    
    armadillo_data = o3d.data.ArmadilloMesh()
    pcd = o3d.io.read_triangle_mesh(
        armadillo_data.path).sample_points_poisson_disk(5000)


    trans_vec = np.array((150.0,0.0,0.0))
    # crashes here if numpy version >= 2.0
    translated_pcd = copy.deepcopy(pcd).translate(trans_vec)

    o3d.visualization.draw_geometries([pcd,translated_pcd],show_ui=True)



if __name__ == "__main__":
    main()

Error message

No response

Expected behavior

Ether bump version of numpy or check numpy version on install. Also a error msg or an exception would be good for better debug

Open3D, Python and System information

- Operating system: Windows 10 64-bit
- Python version: Python 3.10.11 / output from `import sys; print(sys.version)`
- Open3D version: 0.18.0
- System architecture: x86
- Is this a remote workstation?:  no
- How did you install Open3D?: pip

Additional information

No response

omagjhreblin avatar Aug 28 '24 09:08 omagjhreblin

I think this got fixed in #6874 and will be released with 0.19.0.

timohl avatar Aug 30 '24 07:08 timohl

@timohl -- I think I came across a similar issue (let me know if it's not the same)

(.venv) % python
Python 3.9.6 (default, Aug  9 2024, 14:24:13) 
[Clang 16.0.0 (clang-1600.0.26.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import open3d as o3d
/Users/arnoudb/open3d/.venv/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
  warnings.warn(
>>> redwood_rgbd = o3d.data.SampleRedwoodRGBDImages()
>>> color_raw = o3d.io.read_image(redwood_rgbd.color_paths[0])
>>> depth_raw = o3d.io.read_image(redwood_rgbd.depth_paths[0])
>>> rgbd_image = o3d.geometry.RGBDImage.create_from_color_and_depth(color_raw, depth_raw)
>>> pcd = o3d.geometry.PointCloud.create_from_rgbd_image(rgbd_image,o3d.camera.PinholeCameraIntrinsic(o3d.camera.PinholeCameraIntrinsicParameters.PrimeSenseDefault))
zsh: segmentation fault  python
>>> import numpy
>>> numpy.__version__
'2.0.2'

arnoudbuzing avatar Nov 26 '24 19:11 arnoudbuzing

Probably the same. You could try using numpy 1.26.4, if your code and other dependencies allow it, to see if the segmentation fault still occures.

timohl avatar Nov 26 '24 19:11 timohl

Yes, that fixes it, thanks

arnoudbuzing avatar Nov 26 '24 19:11 arnoudbuzing