Open ryanvolz opened 6 months ago
or perhaps more simply, remove all of the inserted code since it doesn't seem necessary for the conda setup. I could take a swing at a PR if that solution sounds acceptable.
This sounds good to me because that code is not really necessary for Conda-forge/Conda. Just my two cents.
Solution to issue cannot be found in the documentation.
Issue
I'm a conda-forge maintainer for
gnuradio
, and for a while I've been seeing reports from users about DLL loading failures having something to do with Qt: https://github.com/ryanvolz/radioconda/issues/78. It turns out to be a strange interaction between multiple things, but it eventually boils down to a fix that might be best applied with the pyqt package.The error sequence
Qt5Core.dll
appears somewhere on the user's PATH, probably by installing a program that bundles Qt and modifiesPATH
to add its binary directory. (On conda-forge, the proper DLL isQt5Core_conda.dll
).Qt5Core.dll
file. (In my case, this is importinggnuradio.qtgui
which needsqwt.dll
, for which a non-conda version is found on the PATH).What's happening
On Windows, PyQt5's
configure.py
inserts the following code into the package's top-level__init__.py
:So the first directory on the user's
PATH
that containsQt5Core.dll
gets added as a DLL search directory withos.add_dll_directory()
. The conda-forgeqt-main
package does not supplyQt5Core.dll
because it suppliesQt5Core_conda.dll
, so normally the search would fail and no directories would be added to the DLL search path by this code. This is fine because the proper Qt libraries are found anyway. Where this goes wrong is if thePATH
contains a directory that does haveQt5Core.dll
. In that case, it is added and preferred in the DLL search order. That's still not necessarily a problem, because PyQt5 and any other conda-forge package that links to Qt will not try to loadQt5Core.dll
because they will look forQt5Core_conda.dll
. However, if that directory that is now preferred in the DLL search order contains other DLLs that other libraries might try to load, then they will end up trying to load these external non-conda-forge libraries. Again, in my example, this happens withgnuradio-qtgui
needingqwt.dll
which happens to frequently pop up bundled next toQt5Core.dll
on users' PATHs.Conclusion
It's clearly a bit buggy that PyQt5 assumes that it is always looking for
Qt5Core.dll
, when clearly packagers like conda-forge can add a suffix and it should be looking forQt5Core_conda.dll
. That's something that could be fixed upstream, although it seems unlikely to me. Alternatively, this feedstock could be patched so that the code inserted fromconfigure.py
tries to look forQt5Core_conda.dll
instead, or perhaps more simply, remove all of the inserted code since it doesn't seem necessary for the conda setup. I could take a swing at a PR if that solution sounds acceptable.