Missing icons using qt-materials inside a virtual environment
11:29 30 Mar 2026

Different behaviour of qt-materials inside virtual environment (venv)

I am currently developing a PySide6 application and using the qt-materials library to set the stylesheet of the application. Initially, I developed this using global site packages. Because it is not best practice though, I switched to developing inside a virtual environment (venv). This alone led some of the custom UI elements to vanish. I also tried this by running the full example of qt_materials inside a venv and using global packages which had the same result.

Qt-materials library is not the root cause here

The first guess I had was that qt-materials is searching for the required SVG-files at the wrong location. By calling apply_theme(...), qt-materials creates a new directory C:/Users/.../.qt_material/theme/ where all icons are located. Also, the QSS-file then only uses a prefix (icon:/...). So I tried

  • replacing the prefix by an absolute path and

  • creating a qrc resource file from a theme and then applying it

However, nothing worked properly.

Then I noticed that another SVG-image which I have added to my Ressource file was also not showing. It was only able to render, when I used a jpeg-file instead. This meant

The qt-materials library works fine; but the svg-rendering is (seemingly) disabled by default in PySide6.

How to solve this

The fix to this is quite simple: By adding the following import statement to the file where the QApplication is created, the required svg-files should render as intended.

import PySide6.QtSvg

Example

from PySide6.QtWidgets import QApplication
import PySide6.QtSvg  # to enable svg rendering

import sys

app = QApplication(sys.argv)
# your code
app.exec()
svg pyqt pyside6 pyqt6 qtstylesheets