pyqt5-tools designer: No module named 'pkg_resources' (fix)

pyqt5-tools 5.15.9.3.3 (the latest) does import pkg_resources in pyqt5_tools/__init__.py, so pyqt5-tools designer fails with ModuleNotFoundError: No module named 'pkg_resources' on setuptools 82+ or in a venv without setuptools. Tested fix: pip install "setuptools<81".

1. The error: pyqt5-tools 5.15.9.3.3 with setuptools 82

pip install pyqt5-tools (5.15.9.3.3, the latest, 2023-03-27; it pulled in qt5-tools, qt5-applications and pyqt5-plugins) into a Python 3.9.25 venv, then pip install -U setuptools, which gave 82.0.1:

$ pyqt5-tools --help
Traceback (most recent call last):
  File "/path/to/venv/bin/pyqt5-tools", line 4, in <module>
    from pyqt5_tools.entrypoints import main
  File "pyqt5_tools/__init__.py", line 7, in <module>
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

pyqt5_tools/__init__.py line 7 is a plain import pkg_resources, and setuptools 82.0.0 removed that module. So pyqt5-tools designer fails before Designer starts. We got the same traceback before installing setuptools at all: venvs made by uv venv, and python -m venv on Python 3.12 and newer, have no setuptools by default.

Switching to the qt5-tools command does not help. It fails the same way, one level deeper:

$ qt5-tools designer --help
...
Traceback (most recent call last):
  File "/path/to/venv/bin/qt5-tools", line 4, in <module>
    from qt5_tools.entrypoints import main
  File "qt5_tools/__init__.py", line 24, in <module>
    qt_applications = import_it("qt_applications")
  File "qt5_tools/__init__.py", line 9, in import_it
    import pkg_resources
ModuleNotFoundError: No module named 'pkg_resources'

2. Fix: pin setuptools below 81 (tested)

$ pip install "setuptools<81"    # gave 80.10.2
$ pyqt5-tools --help
pyqt5_tools/__init__.py:7: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  import pkg_resources
Usage: pyqt5-tools [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  designer
  installuic
  qmlscene
  qmltestrunner

pyqt5-tools designer --help also worked after the pin. No newer pyqt5-tools release exists, and pyqt5_plugins, qt5_tools and qt5_applications all import pkg_resources too, so keep setuptools<81 in this environment. The pkg_resources is deprecated warning above is harmless. To hide it, set PYTHONWARNINGS="ignore:pkg_resources is deprecated as an API".

3. Or skip the wrapper: the Designer binary is already installed

The wrapper commands only locate and start the Qt executables shipped in qt5-applications. In our Linux venv, Designer was at:

/path/to/venv/lib/python3.9/site-packages/qt5_applications/Qt/bin/designer

On Windows, look for designer.exe under Lib\site-packages\qt5_applications\Qt\bin\. Running it directly needs no Python and no pkg_resources. We only checked that the file exists; we did not open the GUI in this run. If you use the wrapper's --widget-path or the example plugins, keep the wrapper and the setuptools pin.

Related: No module named 'pkg_resources' (general fix) · pyqt6-tools (same fix) · pygame warning.

Frequently asked questions

Does qt5-tools designer avoid the error?

No. In our test qt5-tools designer failed with the same ModuleNotFoundError, from qt5_tools/__init__.py line 9.

Why does a fresh venv hit this?

uv venv, and python -m venv on Python 3.12+, create environments without setuptools, so pkg_resources is missing even before any upgrade.

Written with AI assistance. Measured on 2026-10-24 on Linux with pyqt5-tools 5.15.9.3.3, qt5-tools 5.15.2.1.3, PyQt5 5.15.9, CPython 3.9.25, setuptools 80.10.2 and 82.0.1. Output pasted unedited except shortened paths. PlainTables is our extension; pyqt5-tools is free.