paraview python plugin loading with virtualenv

I have a python plugin that is importing some modules that are not included in the Paraview 6.0.0 distribution, but using the –venv option I can add them to a virtualenv and then the plugin works fine.

If I load the plugin from the Plugin Manager everything is ok.

Now I would like to automatically import that plugin putting its path in the PV_PLUGIN_PATH env variable, but the issue is that the plugin loading is done before the virtualenv is considered, so I get an error saying that a module is missing.

Is there a way to post-pone the plugin automatic loading after the virtualenv has been added ?

Thanks in advance for any suggestion

@jourdain Is there any reason to not move –venv handling to be before plugin loading?

what about loading your plugin after importing paraview.simple in your Python script. By then, all paths should be set correctly. Example:

import h5py
import numpy as np
from paraview.simple import *

LoadPlugin("VTKmFilters", ns=globals())

1 Like

It should be fine to set up the –venv before plugin loading. The Python environment should be set up by that time anyway. It was just an oversight in my implementation.

Issue reported: https://gitlab.kitware.com/paraview/paraview/-/issues/23087. Fix incoming.

Fix here: https://gitlab.kitware.com/paraview/paraview/-/merge_requests/7460