Skip to content

Import pymeshlab causes global QT conflicts #446

@arattner1

Description

@arattner1

I have had success using pymeshlab for some filtering. I was trying to add my code to a bigger project that interfaces with another software tool that uses QT (specifically pyfluent for ANSYS Fluent).

It appears that the pymeshlab init method on import changes some global environment variables in a way that causes other QT using packages (like ANSYS Fluent to fail). I am running code in Windows for reference.

Here is an example to reproduce the issue for me:

Works

import ansys.fluent.core as pyfluent
from ansys.fluent.core import Meshing

meshing_session = pyfluent.launch_fluent( mode=pyfluent.FluentMode.MESHING, precision=pyfluent.Precision.DOUBLE, processor_count=4, product_version='252', dimension=pyfluent.Dimension.THREE, ui_mode=pyfluent.UIMode.GUI)

Fails (ANSYS Fluent fails to launch)

import pymeshlab as ml

import ansys.fluent.core as pyfluent
from ansys.fluent.core import Meshing

meshing_session = pyfluent.launch_fluent( mode=pyfluent.FluentMode.MESHING, precision=pyfluent.Precision.DOUBLE, processor_count=4, product_version='252', dimension=pyfluent.Dimension.THREE, ui_mode=pyfluent.UIMode.GUI)

The second example fails with the following error:

qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized...

I suspect this is due to some setup commands at the top of pymeshlab init.py . Probably the following:

# for windows we need to tell which Qt libraries use
this_path = str(pathlib.Path(__file__).parent.absolute())
if platform == 'win32':
    os.environ['QT_PLUGIN_PATH'] = this_path
    os.environ['PATH'] = this_path + os.pathsep + os.environ['PATH']

Thanks for any assistance on this issue!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions