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

Update/implement hook for VTK >= 8.2.0 #327

Open
Jmennius opened this issue Sep 28, 2021 · 7 comments
Open

Update/implement hook for VTK >= 8.2.0 #327

Jmennius opened this issue Sep 28, 2021 · 7 comments

Comments

@Jmennius
Copy link
Contributor

Since VTK 8.2.0 the internal structure of the package has changed significantly making existing hook obsolete (for new versions).

I've gotten my application to work with the following hook (hook-vtkmodules.py, not hook-vtkpython.py):

hiddenimports = ["vtkmodules.vtkCommonMath",
                 "vtkmodules.vtkCommonTransforms",
                 "vtkmodules.vtkCommonExecutionModel",
                 "vtkmodules.vtkIOCore",
                 "vtkmodules.vtkRenderingCore",
                 "vtkmodules.vtkFiltersCore",
                 "vtkmodules.vtkCommonMisc",
                 "vtkmodules.vtkRenderingVolumeOpenGL2",
                 "vtkmodules.vtkImagingMath",
                 ]

But this is only for my specific application (found the with --debug=imports).

Ideally, we'd provide a hook for each module (95% of which are extensions so analysis doesn't work).
Considering the amount of hooks they better be provided by upstream project itself.
I also believe that it is possible to automatically generate hooks based on metadata that exists in the upstream project.

@bwoodsend
Copy link
Member

bwoodsend commented Sep 28, 2021

I've always preferred to just --hiddenimport VTK's submodules in as needed. They're not particularly hard to find and it's far easier to find and add missing modules than it is to find and remove redundantly bundled modules. If someone's really determined enough to go through every submodule and identify exactly which other submodules each one loads then write a hook for each one then that would be good but it'll be misery incarnate. (Possibly PyInstaller.utils.hooks.get_pyextension_imports() could do it programatically albeit slowly?) But failing that, I really don't want to see a brute force collect_submodules("vtkmodules") approach for VTK because it'll dump ~200MB of potentially unused DLLs into every application.

Note that the hook-vtkpython.py is not for vtk but a separate Python port of VTK. We don't have a hook for the official VTK port.

@Jmennius
Copy link
Contributor Author

Jmennius commented Sep 28, 2021

I've always preferred to just --hiddenimport VTK's submodules in as needed. They're not particularly hard to find and it's far easier to find and add missing modules than it is to find and remove redundantly bundled modules. If someone's really determined enough to go through every submodule and identify exactly which other submodules each one loads then write a hook for each one then that would be good but it'll be misery incarnate. (Possibly PyInstaller.utils.hooks.get_pyextension_imports() could do it programatically albeit slowly?) But failing that, I really don't want to see a brute force collect_submodules("vtkmodules") approach for VTK because it'll dump ~200MB of potentially unused DLLs into every application.

Note that the hook-vtkpython.py is not for vtk but a separate Python port of VTK. We don't have a hook for the official VTK port.

Thanks for the info!
I did not realize vtkpython is NOT from upstream VTK (I thought it was an earlier version).
Sadly get_pyextension_imports is not in documentation, but it doesn't seem to be clean solution either.

Regarding finding a nice solution - I have idea and opened an issue to discuss it with VTK folks.

@bwoodsend
Copy link
Member

That does look like a better idea. I'll chime in there.

@Jaime02
Copy link

Jaime02 commented Sep 27, 2022

Any advances fixing this? Do I still need to use hidden imports?

@bwoodsend
Copy link
Member

Nothing's changed. Just --hiddenimport=vtkmodules.xxx the offending submodule every time you get the No module named vtkmodules.xxx message.

@Jaime02
Copy link

Jaime02 commented Sep 28, 2022

@bwoodsend but why not update the hooks?

@bwoodsend
Copy link
Member

For the reasons outlined here and here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants