Hi Carlos.

I don't think an already imported binding should take precedence over the
environment variable (welcome to hear arguments against this take).  The
primary use-case I'm concerned about is matplotlib being installed/imported
when installed from the main conda channel.  That version of matplotlib
uses PyQt5 5.9 I believe, which pyqtgraph no longer supports.  So if a user
has an environment variable set to use PySide2/6 bindings, but does:

import matplotlib as mpl

import pyqtgraph as pg

the import will likely raise an exception due to an unsupported Qt version,
and not give a user a way out around it (I may be wrong with my
understanding of the import mechanisms here though).

There is another solution to that use-case though, and that is to verify
the version of the Qt binding is supported during the attempted import
process, and to move to the next binding if the version is not supported.

On Wed, Jun 16, 2021 at 1:47 AM Carlos Pascual-Izarra <[email protected]>
wrote:

> You are right!
>
> That solves it, I guess.
>
> Just one note: from the code, I understand that if the variable is
> defined, it takes precedence over a pre-loaded module.
>
>
> IMHO it makes more sense decide the binding in the following order of
> precedence:
>
> 1.- already loaded binding?
>
> 2.- environment variable?
>
> 3.- try all in a predefined order
>
> 4.- error
>
>
> The current implementation in pyqtgraph flips 1 and 2
>
>
>
> On 16/06/2021 03:36, Martin Chase wrote:
>
> On Tue, Jun 15, 2021 at 6:33 PM Martin Chase <[email protected]>
> wrote:
>
>> You can set PYQTGRAPH_QT_LIB to e.g. 'PySide2' and that should switch it.
>>
>
> ...This isn't documented, that I can find, I just happened to notice it in
> the source.
> Â
> --
> You received this message because you are subscribed to the Google Groups
> "pyqtgraph" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyqtgraph/CAD_p8v06ERxZph03U1t8nh-ObAnUgYgGvykZV5cbzVyYyrtb0Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/pyqtgraph/CAD_p8v06ERxZph03U1t8nh-ObAnUgYgGvykZV5cbzVyYyrtb0Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> --
> +----------------------------------------------------+
>  Carlos Pascual Izarra
>  Scientific Software Coordinator
>  Computing Division
>  ALBA Synchrotron  [http://www.albasynchrotron.es]
>  Carrer de la Llum 2-26
>  E-08290 Cerdanyola del Valles (Barcelona), Spain
>  E-mail: [email protected]
>  Phone: +34 93 592 4428
> +----------------------------------------------------+
>
> --
> You received this message because you are subscribed to the Google Groups
> "pyqtgraph" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/pyqtgraph/3cb3f102-d3d1-06b6-c9a8-2426b8bb0d2f%40cells.es
> <https://groups.google.com/d/msgid/pyqtgraph/3cb3f102-d3d1-06b6-c9a8-2426b8bb0d2f%40cells.es?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/CA%2BnduTGZjtLN4hCsxD6G3P4Qf8yVMz0VFkepWajGMCfzD_m%3DhQ%40mail.gmail.com.

Reply via email to