2

When trying to build a QGIS plugin with Plugin Builder 3, I get the message that pyrcc5 was not found in my path.

I installed PyQt using brew install pyqt, but still nothing. Instead, I tried to run the pyrcc5 executable that ships with QGIS like this

/Applications/QGIS-LTR.app/Contents/MacOS/bin/pyrcc5

and get this error:

./pyrcc5: line 2: exec: /Applications/QGIS-LTR.app/Contents/MacOS/bin/`dirname $0`/python3.8: cannot execute: No such file or directory

Am I missing some step in the installation or setup?

macOS Version 10.15.7

QGIS version 3.16.8-Hannover (LTR; installer from the official QGIS website)

6
  • "I tried to run the pyrcc5". How? you type pyrcc5 anywhere, you provide absolute path, you do cd and pyrcc5? Edit you question to add the informations
    – ThomasG77
    Commented Jul 9, 2021 at 9:23
  • 1
    pyrcc5 shouldn't be used anymore, in PyQt6 it won't even be available anymore, see e.g. the qgis dev list. Was always painful and its purpose is very questionable in a python enviromnent. The plugin builder should remove it too IMO, there's an issue already.
    – nilsnolde
    Commented Jul 9, 2021 at 10:19
  • BTW, the problem is not pyrrc5 here, that exists since it's giving the error. Where's your QGIS python installation actually located? /Applications/QGIS-LTR.app/Contents/MacOS/bin/dirname $0/python3.8 probably smth wrong with how pyrcc5 interprets that..
    – nilsnolde
    Commented Jul 9, 2021 at 10:24
  • True, I should rephrase the question. QGIS's python is /Applications/QGIS-LTR.app/Contents/MacOS/bin/
    – Christian
    Commented Jul 9, 2021 at 10:25
  • 1
    As mentioned before, you should try to not use pyrcc.
    – etrimaille
    Commented Jul 9, 2021 at 10:36

2 Answers 2

4

Thanks @nnolde for pointing me towards the cause of the brew install not working: brew install pyqt installs pyqt@6.

brew install pyqt@5 did the trick.

1
  • Saved my day! Thanks a lot
    – Jim Panse
    Commented Aug 17, 2022 at 16:47
0

pyqt@5 and in particular its dependency qt@5 has problem with freetype.. It does not the trick for all..

So, waiting for an official QGIS solution, I've found a simpler trick to solve the problem of pyrcc5, without installing anything more.

  1. Edit the plugin_builder.py inside plugin folder, replacing 'pyrcc5' inside cmd instruction with its complete path (ie. '/Applications/QGIS-LTR.app/Contents/MacOS/bin/pyrcc5'
  2. Save
  3. Edit pyrcc5 file (located in /Applications/QGIS-LTR.app/Contents/MacOS/bin/pyrcc5), replacing 'dirname $0/python3.9' with dirname $0/python3.9 (removing quotes)
  4. Save
  5. Reload Plugin Builder inside QGIS-LTR or open QGIS-LTR again

Everything that deals with 'QGIS-LTR' is ok also for 'QGIS', paths too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.