[Qgis-user] 3.16.8+ LTR vs. old 3.16.x for SIP and PyQt5 imports

Ari Meyer ari.meyer at gmail.com
Thu Aug 12 15:06:02 PDT 2021


I was receiving mail in digest mode, so it didn't appear that I could
respond to a message.  Is there a way to do this?

Thank you, Jurgen -- that trick did the job.  Is this "fix" documented
anywhere?  Is there any more reliable solution?  I'm concerned that some of
our devs won't remember to put qgis higher in the imports, and we'll have
to keep dealing with this.

Also, why is it that we only encounter this problem when running from
outside of QGIS?  When running within QGIS, we don't have any such issues.

Regarding the 3.16.9 LTR in the old repo, I did install that as well, and
it worked, but it came with the old dependencies and Python 3.7, so I was
hoping to get a solution with the new repo.

Best,
Ari


Hi Ari,

On Wed, 11. Aug 2021 at 17:16:35 -0500, Ari Meyer wrote:
> Test with python-qgis-ltr.bat:
> Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sip

This issue is due to Python 3.9.  It doesn't use PATH to find DLLs anymore.
Thereore the qgis module now splits PATH and uses os.add_dll_directory on
each,
After that it should behave as before.  So your fix should be to import qgis
first.

BTW the latest LTR is also in old osgeo4w and should be not affected.


Jürgen

-- 
Jürgen E. Fischer           norBIT GmbH             Tel. +49-4931-918175-31
Dipl.-Inf. (FH)             Rheinstraße 13          Fax. +49-4931-918175-50
Software Engineer           D-26506 Norden            https://www.norbit.de
QGIS release manager (PSC)  Germany                 IRC: jef on Libera|OFTC

On Wed, Aug 11, 2021 at 5:16 PM Ari Meyer <ari.meyer at gmail.com> wrote:

> Hi,
>
> I mistakenly posted this to the Nabble list just before it got shut down.
>
> I wrote (adding some specifics):
> There were clearly major changes in 3.16.8+ LTR compared with the older
> 3.16.x and 3.18.y (apparently to bring it in line with 3.20+).  We have had
> problems with the new LTR versions when attempting to import SIP and
> PyQt5.  Everything else seems to work fine, at least so far.
> V2 installer:
> * Desktop
> * qgis-ltr 3.16.9-1
> * saga: SAGA
> * Libs
> * qgis-ltr-grass-plugin
> * python3-geopandas
> * python3-pip
> * python3-scipy
> * python3-setuptools
>
> Test with python-qgis-ltr.bat:
> Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64
> bit (AMD64)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import sip
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ModuleNotFoundError: No module named 'sip'
> >>> import PyQt5
> >>> from PyQt5.QtWidgets import QHBoxLayout, QLabel, QPushButton,
> QTreeWidgetItem, QWidget
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> ImportError: DLL load failed while importing QtWidgets: The specified
> module could not be found.
> >>>
>
> With 3.16.3, for instance, we don't see these errors.  I have tried to
> trace through everything in the old and new versions, but can't seem to
> identify the problem with 3.16 LTR.  Any ideas?  Is this a problem
> specifically with the Windows DLLs, or are users on other platforms
> experiencing similar problems?
>
>
> Andrea Giudiceandrea responded:
> I think the changes are not in QGIS itself, but in the new versions of the
> dependencies installed with the new installer.
> If you need to use previous dependencies, then you need to install QGIS
> using the installers from from the "old OSGeo4W" repository.
>
>
> I replied:
> It doesn't appear to be merely a difference in dependency versions -- I
> can't reference these dependencies at all now.  SIP and PyQt5 must be
> included with QGIS 3.16.9 LTR, as our plugin code runs fine within it, but
> I now can't import them from outside QGIS via the included
> python-qgis-ltr.bat script, though, as shown, it works fine when using the
> python-qgis.bat in the old 3.16.3.  Am I missing something?
>
>
> He responded:
> I think the issue is not in QGIS 3.16.9 itself, compared with QGIS 3.16.3.
> It seems the issue is in the packaging of QGIS and its dependencies within
> the new (v2/msi) OSGeo4W repository, while there is no issue with the old
> (v1/exe) OSGeo4W repository.
> QGIS 3.16.9 LTR is also available, with old packaging dependencies, using
> the old OSGeo4W installer. Have you tried it?
>
>
>
> So I tried with the V1 installer.  I installed with *essentially* the same
> options:
> - not sure about the GRASS plugin: common or 7? -- I picked common
> - there are different versions of various dependencies between V1 and V2,
> as expected
>
> In any case, with the V1 install of 3.16.9 LTR, at least SIP/PyQt5
> imported fine.  One big difference I could immediately see, though, is that
> it installed Python 3.7.0 instead of 3.9.5, which is usable, but 3.9 would
> definitely be preferable.  I am concerned that if we stuck with V1 that we
> wouldn't be supported to the same degree -- not sure if that's unwarranted.
>
> I do believe, though, that the problems we are seeing after installing
> qgis-ltr 3.16.9-1 with the V2 installer indicate some problem with the
> installation and the python-qgis-ltr.bat environment config.  Is there
> something else I need to do to get it to work?
>
> Thanks,
> Ari
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210812/286b71ea/attachment.html>


More information about the Qgis-user mailing list