ImportError - No module named resources_rc (QGIS Plugin Development) [SOLVED]

10 Apr 2017 ᛫ 1 min read

SHARE:

If you did not create your QGIS plugin using the latest version of QGIS Plugin Builder, you might find yourself encountering this error when running your plugin in QGIS specially if you have a resources file for images/logos that you included in your plugin.

ImportError: No module named resources_rc

This error seems to stem from the fact that when you have resources in your GUI from resource.qrc, the following lines are added to your .ui files:

<resources>
  <include location="resources.qrc" \>
</resources>

One of the solutions for this issue is by removing the said line in the .ui files and replacing them with:

<resources \>

then compiling the .ui files to .py files using pyuic.

However, my simpler solution involves just one command. Since python is looking for a resources_rc module, all I did was compile my resources.qrc to resources_rc.py instread of resources.py.

pyrcc resources.qrc -o resources_rc.py

And viola, my plugins worked and the images I added to the GUIs were all present.

SHARE:
comments powered by Disqus

You may also like:

Towards a spatial analysis of shooting in Philippine basketball (FOSS4G2021)

01 Oct 2021 ᛫ 1 min read

Win and let win: On being unconventional, openness, and building communities

30 Apr 2021 ᛫ 1 min read

QGIS Styles based on HLURB Land Use Categories and Color Coding (CLUP Guidebook Vol 3, 2014)

15 Dec 2020 ᛫ 2 min read

Select duplicate geometries from a layer in QGIS

09 Dec 2020 ᛫ 3 min read

Get Data from DPWH Road and Bridge Inventory in QGIS

29 Nov 2020 ᛫ 2 min read

Support BNHR

If you find my website or any of the materials I share useful, you can consider donating to the cause below.

Donate and support BNHR

BNHR

[email protected]

Creative Commons License
Except when explicitly stated otherwise, this work and its contents by Ben Hur S. Pintor is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Other works (software, source code, etc.) referenced in this website are under their own respective licenses.
This site is powered by Jekyll and hosted on Github (view source)