Describe the bug
The pip installed jupyter visualization is broken in python27.
To Reproduce
Steps to reproduce the behavior:
import numpy as np
import open3d as o3
from open3d import JVisualizer
pts_path = "examples/TestData/fragment.ply"
fragment = o3.read_point_cloud(pts_path)
visualizer = JVisualizer()
visualizer.add_geometry(fragment)
visualizer.show()
AttributeError Traceback (most recent call last)
<ipython-input-37-4d6d5090de1b> in <module>()
6 fragment = o3.read_point_cloud(pts_path)
7 visualizer = JVisualizer()
----> 8 visualizer.add_geometry(fragment)
9 visualizer.show()
/home/<OMITTED>/.local/lib/python2.7/site-packages/open3d/j_visualizer.pyc in add_geometry(self, geometry)
73 # so we keep track of self.geometries and self.geometry_jsons.
74 self.geometries.append(geometry)
---> 75 self.geometry_jsons = [geometry_to_json(g) for g in self.geometries]
76
77 def clear(self):
/home/<OMITTED>/.local/lib/python2.7/site-packages/open3d/j_visualizer.pyc in geometry_to_json(geometry)
35 """Convert Open3D geometry to Json (Dict)"""
36 json = dict()
---> 37 if isinstance(geometry, o3.PointCloud):
38 json['type'] = 'PointCloud'
39 # TODO: do not flatten
AttributeError: 'module' object has no attribute 'PointCloud'
Expected behavior
A pointcloud to be plotted without an error. o3 appears to be imported without the PointCloud class in its namespace. Removed this line in the source resolves the issue:
"""Convert Open3D geometry to Json (Dict)"""
json = dict()
# if isinstance(geometry, o3.PointCloud):
if True:
json['type'] = 'PointCloud'
# TODO: do not flatten
Screenshots
None
Environment (please complete the following information):
Additional context
This doesn't occur in python36
We are dropping support for python 2. Sorry.
AttributeError Traceback (most recent call last)
6 fragment = o3d.io.read_point_cloud(pts_path)
7 visualizer = JVisualizer()
----> 8 visualizer.add_geometry(fragment)
9 visualizer.show()
2 frames
/usr/local/lib/python3.6/dist-packages/open3d/j_visualizer.py in add_geometry(self, geometry)
73 # so we keep track of self.geometries and self.geometry_jsons.
74 self.geometries.append(geometry)
---> 75 self.geometry_jsons = [geometry_to_json(g) for g in self.geometries]
76
77 def clear(self):
/usr/local/lib/python3.6/dist-packages/open3d/j_visualizer.py in
73 # so we keep track of self.geometries and self.geometry_jsons.
74 self.geometries.append(geometry)
---> 75 self.geometry_jsons = [geometry_to_json(g) for g in self.geometries]
76
77 def clear(self):
/usr/local/lib/python3.6/dist-packages/open3d/j_visualizer.py in geometry_to_json(geometry)
35 """Convert Open3D geometry to Json (Dict)"""
36 json = dict()
---> 37 if isinstance(geometry, o3.PointCloud):
38 json['type'] = 'PointCloud'
39 # TODO: do not flatten
AttributeError: module 'open3d' has no attribute 'PointCloud'
Same error python 3.7.3
How did you install the package? Which OS?
Google Colab
!pip install open3d
import numpy as np
import open3d as o3d
from open3d import JVisualizer
pts_path = "j001.ply"
fragment = o3d.io.read_point_cloud(pts_path)
visualizer = JVisualizer()
visualizer.add_geometry(fragment)
visualizer.show()
same on a local Jupyter, ubuntu 16
AttributeError Traceback (most recent call last)
6 fragment = o3d.io.read_point_cloud(pts_path)
7 visualizer = JVisualizer()
----> 8 visualizer.add_geometry(fragment)
9 visualizer.show()
/usr/local/lib/python3.5/dist-packages/open3d/j_visualizer.py in add_geometry(self, geometry)
73 # so we keep track of self.geometries and self.geometry_jsons.
74 self.geometries.append(geometry)
---> 75 self.geometry_jsons = [geometry_to_json(g) for g in self.geometries]
76
77 def clear(self):
/usr/local/lib/python3.5/dist-packages/open3d/j_visualizer.py in
73 # so we keep track of self.geometries and self.geometry_jsons.
74 self.geometries.append(geometry)
---> 75 self.geometry_jsons = [geometry_to_json(g) for g in self.geometries]
76
77 def clear(self):
/usr/local/lib/python3.5/dist-packages/open3d/j_visualizer.py in geometry_to_json(geometry)
35 """Convert Open3D geometry to Json (Dict)"""
36 json = dict()
---> 37 if isinstance(geometry, o3.PointCloud):
38 json['type'] = 'PointCloud'
39 # TODO: do not flatten
AttributeError: module 'open3d' has no attribute 'PointCloud'
How did you install the package? Which OS?
conda install -c open3d-admin open3d
Win 10
same error with python3.6.8, install open3d from source
Same error on python 3.6.8. Installed using pip install open3d
I have the same error on python 3.7.4 using pip install open3d on mac.
pip install open3d-python fixes the "no attribute 'PointCloud'" problem for me. I'm using Ubuntu 16.04 and python36.
Same Error on Win10 Python3.7 by conda install -c open3d-admin open3d
Monkey patching with
o3.PointCloud = o3.geometry.PointCloud
should solve the issue until the next release.
I haven't had any issues with this patch but I cannot guarantee that it won't cause any errors if other parts of the lib are still relying on o3.PointCloud.
Same Error on Win10 Python3.6 by conda install -c open3d-admin open3d
import numpy as np
import open3d as o3
from open3d import JVisualizer
pts_path = "D:/project/python/open3d/surces/TestData/fragment.ply"
fragment = o3.read_point_cloud(pts_path)
visualizer = JVisualizer()
visualizer.add_geometry(fragment)
visualizer.show()
AttributeError: module 'open3d' has no attribute 'read_point_cloud'
what it mean??
@yxlao could you take a look at this?
Similar issue:
I tried installing in Linux Ubuntu 20 / Anaconda env / with conda install -c open3d-admin open3d with pip install open3d-python and !pip install open3d but nothing same error with read_point_cloud. also when I do python -c "import open3d as o3d" nothing happen. Any help?
Most helpful comment
pip install open3d-pythonfixes the "no attribute 'PointCloud'" problem for me. I'm using Ubuntu 16.04 and python36.