Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make VTK version error clear when PointSet is still abstract #2483

Merged
merged 3 commits into from
Apr 28, 2022

Conversation

adeak
Copy link
Member

@adeak adeak commented Apr 18, 2022

As of version 0.34.0 we support VTK 9.1's concrete PointSet class. However the error we tried to raise in __init__ isn't visible when you try to instantiate the class on old VTK:

>>> import pyvista as pv
>>> pv.vtk_version_info
VTKVersionInfo(major=9, minor=0, micro=3)
>>> pv.PointSet()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: this is an abstract class and cannot be instantiated

The reason for this is that our PointSet inherits its __new__ method from vtk.vtkPointSet, which raises this error. The reason why other subclasses work is that they inherint from the corresponding concrete vtk subclasses, e.g. PolyData from vtkPolyData.

If we move the version check to a newly defined thin __new__ wrapper it seems to work:

>>> pv.PointSet()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/adeak/pyvista/pyvista/core/pointset.py", line 404, in __new__
    raise VTKVersionError("pyvista.PointSet requires VTK >= 9.1.0")
pyvista.core.errors.VTKVersionError: pyvista.PointSet requires VTK >= 9.1.0

The test suite seems to pass, so hopefully the wrapping works otherwise.

I don't know if we need a # pragma: no cover for the error's branch, I've omitted for now. If codecov screams I'll add it back.

@adeak adeak added the bug Uh-oh! Something isn't working as expected. label Apr 18, 2022
@akaszynski
Copy link
Member

This just missed the patch release I'm putting for #2415. If we need another patch I'll include it.

@codecov
Copy link

codecov bot commented Apr 18, 2022

Codecov Report

Merging #2483 (4f7c617) into main (18c2992) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2483      +/-   ##
==========================================
+ Coverage   93.67%   93.72%   +0.05%     
==========================================
  Files          75       75              
  Lines       16052    16120      +68     
==========================================
+ Hits        15036    15108      +72     
+ Misses       1016     1012       -4     

@akaszynski
Copy link
Member

Our CI is so hard to impress:

Exception: Sphinx reported unique 1 warnings
WARNING: [numpydoc] Validation warnings while processing docstring for 'pyvista.PointSet':

PR01: Parameters {'**kwargs', '*args'} not documented

PR02: Unknown parameters {'deep', 'points', 'force_float'}

@adeak
Copy link
Member Author

adeak commented Apr 18, 2022

OK, I don't get it.

First, why does __new__ cause that? The method itself doesn't seem to be documented... But it seems that this is the first class of ours that has a custom __new__, so perhaps we need to specify somewhere (in conf.py?) to ignore __new__ altogether?

Second, the second warning with {'deep', 'points', 'force_float'} can only come from __init__. What's up with that??

Third, I get a bunch of other warnings and some errors during doc building that we might need to fix:

2022-04-18 21:11:30.373 ( 722.630s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCSymmetryPlane' not supported yet.                            
2022-04-18 21:11:30.400 ( 722.657s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCExtrapolate' not supported yet.
2022-04-18 21:11:30.400 ( 722.657s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.401 ( 722.658s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.401 ( 722.658s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCWallViscousHeatFlux' not supported yet.
2022-04-18 21:11:30.421 ( 722.678s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCSymmetryPlane' not supported yet.
2022-04-18 21:11:30.421 ( 722.678s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCExtrapolate' not supported yet.
2022-04-18 21:11:30.421 ( 722.678s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.421 ( 722.678s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.421 ( 722.678s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCWallViscousHeatFlux' not supported yet.
2022-04-18 21:11:30.431 ( 722.688s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCSymmetryPlane' not supported yet.
2022-04-18 21:11:30.431 ( 722.688s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCExtrapolate' not supported yet.
2022-04-18 21:11:30.431 ( 722.688s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.431 ( 722.688s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.431 ( 722.688s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCWallViscousHeatFlux' not supported yet.
2022-04-18 21:11:30.435 ( 722.692s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCSymmetryPlane' not supported yet.
2022-04-18 21:11:30.435 ( 722.692s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCExtrapolate' not supported yet.
2022-04-18 21:11:30.435 ( 722.692s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.435 ( 722.692s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.
2022-04-18 21:11:30.436 ( 722.692s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.

Later some PBR-related warnings that I remember seeing before; not sure if those have always been there or it's a regression, and it might be due to my lack of GPU:

2022-04-18 21:12:04.305 ( 756.562s) [        F85BE740]  vtkOpenGLRenderer.cxx:250   WARN| vtkOpenGLRenderer (0x71f1f60): Cannot compute spherical harmonics of a cubemap, fall back to irradiance texture          
2022-04-18 21:12:05.182 ( 757.439s) [        F85BE740]  vtkOpenGLRenderer.cxx:250   WARN| vtkOpenGLRenderer (0x71f1f60): Cannot compute spherical harmonics of a cubemap, fall back to irradiance texture

VTK errors after the first block of warnings:

2022-04-18 21:11:30.438 ( 722.695s) [        F85BE740]vtkDemandDrivenPipeline:666    ERR| vtkCompositeDataPipeline (0x13f7e120): Input port 0 of algorithm vtkAppendFilter(0x19e25df0) has 0 connections but is not optional.
2022-04-18 21:11:30.439 ( 722.696s) [        F85BE740]vtkDemandDrivenPipeline:666    ERR| vtkCompositeDataPipeline (0x19e040e0): Input port 0 of algorithm vtkAppendFilter(0x19e25f30) has 0 connections but is not optional.
2022-04-18 21:11:30.443 ( 722.700s) [        F85BE740]vtkDemandDrivenPipeline:666    ERR| vtkCompositeDataPipeline (0x19e040e0): Input port 0 of algorithm vtkAppendFilter(0x19e26070) has 0 connections but is not optional.
2022-04-18 21:11:30.445 ( 722.702s) [        F85BE740]vtkDemandDrivenPipeline:666    ERR| vtkCompositeDataPipeline (0x19e040e0): Input port 0 of algorithm vtkAppendFilter(0x13e38680) has 0 connections but is not optional.

This is with VTK 9.1.0 with freshly updated requirements_* packages on debian linux.

@akaszynski
Copy link
Member

I first saw this when upgrading from vtk=9.0.3 to vtk=9.1.0

2022-04-18 21:12:04.305 ( 756.562s) [        F85BE740]  vtkOpenGLRenderer.cxx:250   WARN| vtkOpenGLRenderer (0x71f1f60): Cannot compute spherical harmonics of a cubemap, fall back to irradiance texture          

This is because we read in boundary conditions by default.

2022-04-18 21:11:30.436 ( 722.692s) [        F85BE740]      vtkCGNSReader.cxx:2079  WARN| vtkCGNSReader (0x59cb2d0): Skipping BC_t node: BC_t type 'BCFarfield' not supported yet.

@adeak
Copy link
Member Author

adeak commented Apr 18, 2022

For completeness' sake, looking at https://github.com/pyvista/pyvista/runs/6062869045?check_suite_focus=true it seems that the CGNS VTK warnings and errors are coming from api/examples/_autosummary/pyvista.examples.downloads.download_cgns_multi, and the OpenGL warning comes from api/examples/_autosummary/pyvista.examples.downloads.download_sky_box_cube_map.

Copy link
Member

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We'll fix the warnings later.

@adeak
Copy link
Member Author

adeak commented Apr 28, 2022

Thanks for the commit @akaszynski, I distracted myself by fixing up the validation set on a separate branch, then forgot to come back to this. I'll open that one when this is merged, including this addition.

@akaszynski akaszynski merged commit 9a1373d into pyvista:main Apr 28, 2022
adeak added a commit to adeak/pyvista that referenced this pull request Apr 28, 2022
* upstream/main:
  Make VTK version error clear when PointSet is still abstract (pyvista#2483)
  Use imageio intersphinx links (pyvista#2489)
  Fix glyphs when orienting with cell data (pyvista#2500)
  Bump mypy from 0.942 to 0.950 (pyvista#2522)
  Update hypothesis requirement from <6.45.1 to <6.45.2 (pyvista#2523)
  Add many Readers (pyvista#2496)
  Bump trimesh from 3.10.8 to 3.11.2 (pyvista#2519)
  Return actor from add_mesh_threshold (pyvista#2516)
  fix uniformgrid.x docstring (pyvista#2511)
  Update imageio requirement from <2.18.0 to <2.19.0 (pyvista#2506)
  Update hypothesis requirement from <6.44.1 to <6.45.1 (pyvista#2507)
  add polyhedral example (pyvista#2505)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Uh-oh! Something isn't working as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants