spyder-ide / qtpy

Provides an uniform layer to support PyQt5, PySide2, PyQt6, PySide6 with a single codebase
MIT License
964 stars 152 forks source link

Fix flaky importlib error on Ubuntu Python 3.7 conda CI job #423

Closed CAM-Gerlach closed 1 year ago

CAM-Gerlach commented 1 year ago

The Test ubuntu-latest Python 3.7 conda=Yes CI job fails approximately every other time with the error ERROR module 'importlib_metadata' has no attribute 'distributions': Example Run. We should probably look into that and do something about it.

ccordoba12 commented 1 year ago

3.7 is about to reach end-of-life, so I'd suggest to drop it from our CIs instead of investing time trying to fix this

CAM-Gerlach commented 1 year ago

After looking in to this further I found conda/conda#12390 which explains what's going on; basically, the issue is that the Conda solver solution can sometimes be unstable and not fully accurate when only using repodata_current.json; in this case it's happening to the Python 3.7 job, but it could theoretically happen to others as well, or if we bumped the version.

However, the solution is to just use the Mamba solver instead, which not only ensures a more stable solve, but speeds up the (currently slower) conda=yes jobs by an average of approximately 2x (especially when combined with some other optimizations, particularly doing a one-pass env creation and installation rather than installing the Qt bindings separately, which also further improves stability and reduces the chance for issues). Plus the various tweaks end up making our CI scripts less duplicative and more maintainable too.

See PR #425 for those fixes and improvements.