Maintenance note (September 2026): “Solved” describes one 2019 machine, not a universal repair. The original workaround hard-linked executables into a private
pyqt5_toolspath. That can hide an environment mismatch and break again after an update. The maintained guide below starts with read-only diagnosis, uses the active environment’s own tools, and keeps the complete original post in the archive, with invisible trailing whitespace normalized.
The error names an executable, but it does not identify the failing layer. Qt Designer’s normal uic workflow generates C++ from a .ui file, PyQt5’s pyuic5 generates Python, and the third-party pyqt5-tools package adds its own Designer launcher and compatibility bridge. Diagnose those as separate tools before changing files.
Table of Contents
What the 2019 workaround proved—and did not prove
The historical machine had these two files:
C:\Miniconda3\Lib\site-packages\pyqt5_tools\uic.exe
C:\Miniconda3\Scripts\pyuic5.exe
Designer looked instead for:
C:\Miniconda3\Lib\site-packages\pyqt5_tools\bin\uic.exe
A hard link made that lookup succeed. It proved only that Designer could execute the linked file on that installation. It did not prove that this is the correct layout for another pyqt5-tools, PyQt5, Qt, Python, Conda, or Windows version.
The archive also says Windows cannot create hard links. That statement is incorrect: Microsoft documents fsutil hardlink create for NTFS. A hard link is still a poor first repair here because it duplicates an internal package path assumption, survives independently of package metadata, and may become stale when either package is replaced. No third-party shell extension is required for the diagnostic or recommended workflow below.

First choose the result you actually need
| Goal | Appropriate tool boundary | Recommended route |
|---|---|---|
Generate Python from form.ui |
PyQt5 pyuic5 or PyQt5.uic |
Convert with the active project’s Python environment; Designer’s View Code menu is optional. |
| Preview or generate Qt/C++ code | Qt Designer and Qt uic |
Use a matching Qt toolset. Do not replace Qt’s compiler with an arbitrary PyQt launcher. |
Launch the Designer bundled by pyqt5-tools |
Third-party pyqt5-tools wrapper |
Run the wrapper from the same environment that owns the package and verify its version-specific help. |
Load a .ui file at runtime |
PyQt5 uic.loadUi() or a generated module |
Choose one project-wide workflow and test it with the deployed PyQt5 version. |
Riverbank documents pyuic5 as the command-line interface to PyQt5’s uic module. Qt documents its Designer .ui file as XML and its normal uic output as C++ code. This distinction explains why a Designer View Code failure does not automatically mean that PyQt5 imports or Python code generation are broken.
1. Capture the active environment without changing it
Open the Conda prompt or PowerShell session used by the project. Replace PROJECT_ENV with the intended environment name; do not assume base is correct.
conda info --envs
conda activate PROJECT_ENV
Get-Command python -All
Get-Command pyuic5 -All -ErrorAction SilentlyContinue
Get-Command pyqt5-tools -All -ErrorAction SilentlyContinue
python -c "import sys; print(sys.executable); print(sys.version)"
python -m pip --version
python -m pip show --files PyQt5 pyqt5-tools
python -m pip check
conda list | Select-String -Pattern '^(pyqt|qt|python|pip)\s'
Record the complete output. sys.executable identifies the interpreter actually running. Get-Command -All exposes shadowed commands from other environments, pip show --files shows package-owned files, and pip check reports incompatible or missing Python dependencies. None of these commands reinstalls or deletes anything.
2. Classify the exact failure
| Symptom | Likely class | What it means |
|---|---|---|
Designer says Unable to launch ...\pyqt5_tools\bin\uic.exe |
Designer companion path/layout | Designer expects a helper that is missing at that package-specific path. This alone says nothing about pyuic5. |
pyuic5.exe says Fatal error in launcher or names an old Python path |
Stale entry-point launcher/interpreter | Python installers create Windows command wrappers in an environment’s Scripts directory. A copied or moved environment can leave the wrapper targeting the wrong interpreter. On Unix this is often called a shebang problem; do not hex-edit the Windows .exe. |
pyuic5 is “not recognized” |
Activation/PATH | The intended environment is inactive, its Scripts directory is absent from PATH, or the entry point was not installed. |
ModuleNotFoundError: PyQt5 |
Wrong interpreter or missing distribution | Compare sys.executable, Get-Command python, and python -m pip show PyQt5. |
DLL load failed, plugin-load errors, or incompatible requirements |
Binary/version/toolset mismatch | Check the exact Python architecture and the PyQt5, Qt, plugin, and tools versions before changing packages. |
| Conversion runs but generated code fails | .ui/resource/API compatibility |
Reproduce with the smallest .ui file and the same PyQt5 version; this is not a launcher-path repair. |
The wording matters. Save the full console error and the exact menu or command that produced it; a screenshot of only the last line loses the interpreter and path evidence.
3. Inspect the environment-owned paths
After activating the intended environment, let PowerShell derive its root instead of hard-coding C:\Miniconda3:
$pythonPath = (Get-Command python).Source
$environmentRoot = Split-Path $pythonPath
$scriptsPath = Join-Path $environmentRoot 'Scripts'
$historicalHelper = Join-Path $environmentRoot 'Lib\site-packages\pyqt5_tools\bin\uic.exe'
$pythonPath
$environmentRoot
Test-Path -LiteralPath $scriptsPath -PathType Container
Test-Path -LiteralPath (Join-Path $scriptsPath 'pyuic5.exe') -PathType Leaf
Test-Path -LiteralPath (Join-Path $scriptsPath 'pyqt5-tools.exe') -PathType Leaf
Test-Path -LiteralPath $historicalHelper -PathType Leaf
Get-ChildItem -LiteralPath $environmentRoot -Filter uic.exe -Recurse -ErrorAction SilentlyContinue
Compare these results with python -m pip show --files. A file existing somewhere under the environment is not evidence that Designer is supposed to use it. Likewise, manually copying an .exe does not register ownership or make its interpreter and Qt dependencies match.
4. Generate Python without relying on Designer’s View Code
If the actual goal is Python output, first try the environment’s documented PyQt5 command and write to a new file so an existing generated module is not overwritten:
pyuic5 .\form.ui -o .\ui_form_generated.py
python -m py_compile .\ui_form_generated.py
Inspect the diff before replacing any checked-in generated file. Riverbank warns that generated code depends on the PyQt5 version used to create it, so regenerate and test with the version your application deploys.
If importing PyQt5 works but only the pyuic5.exe launcher is stale, this small script exercises the official PyQt5.uic.compileUi() API directly. It validates the generated source in memory and atomically replaces only the new output file:
from io import StringIO
import os
from pathlib import Path
from tempfile import NamedTemporaryFile
from PyQt5 import uic
source = Path("form.ui")
target = Path("ui_form_generated.py")
buffer = StringIO()
uic.compileUi(str(source), buffer, from_imports=True)
generated = buffer.getvalue()
compile(generated, str(target), "exec")
temporary_path = None
try:
with NamedTemporaryFile(
"w",
encoding="utf-8",
newline="\n",
dir=target.parent,
prefix=target.name + ".",
suffix=".tmp",
delete=False,
) as temporary:
temporary.write(generated)
temporary_path = Path(temporary.name)
os.replace(temporary_path, target)
temporary_path = None
finally:
if temporary_path is not None:
try:
temporary_path.unlink()
except FileNotFoundError:
pass
Run it with the interpreter already identified by sys.executable, then run python -m py_compile .\ui_form_generated.py. This bypasses a broken console launcher; it does not repair Designer’s private helper path.
5. Repair the failing layer, not every package
A. Stale launcher or mixed environment
Capture a rollback record first:
conda list --explicit > .\conda-explicit-before.txt
python -m pip freeze > .\pip-before.txt
Prefer a sibling environment built from the project’s recorded requirements or lock file. Validate it before changing an IDE interpreter or deleting the old environment. Conda’s current guidance recommends isolation and recreating an environment when changes are needed after pip has been used.
Do not move a virtual/Conda environment directory, copy only pyuic5.exe, edit a launcher binary, or add every Python Scripts directory to the global PATH. Those approaches make command resolution less reproducible.
B. Missing pyqt5-tools Designer bridge
pyqt5-tools is a third-party companion project, not part of Riverbank’s PyQt5 wheel. Its current PyPI page labels it Beta, shows its latest release as March 2023, declares Python 3.7 or later, and lists Python classifiers only through 3.9. That metadata is a compatibility clue, not proof that any particular Python/Qt combination works.
The project currently documents a version-specific installuic subcommand for Designer code viewing. Its same page unexpectedly refers to copying pyuic6.exe and says one Designer menu route remains broken. Treat that inconsistency as a reason to test only in a disposable or easily recreated sibling environment:
& "$env:CONDA_PREFIX\Scripts\pyqt5-tools.exe" --help
& "$env:CONDA_PREFIX\Scripts\pyqt5-tools.exe" installuic --help
Only if the installed version’s help and package documentation match your environment should you run the subcommand itself:
& "$env:CONDA_PREFIX\Scripts\pyqt5-tools.exe" installuic
Re-run the path inventory and conversion tests afterward. Do not use this bridge merely to make Python from .ui; pyuic5 or PyQt5.uic already provides that supported PyQt5 boundary.
C. Version or binary mismatch
Do not start with an unpinned “reinstall everything.” Preserve the failing environment, read the resolver error, and test a compatible Python/PyQt5/tools set in a new environment. Package availability depends on Python version, architecture, and platform. A successful install is only the first gate: pip check, import, conversion, compile, and Designer launch must all pass.
D. Qt/C++ View Code is the real goal
Use uic from the same Qt distribution as Designer. Qt’s official workflow generates a C++ header from the XML .ui file. A PyQt-specific helper is the wrong substitute unless the chosen third-party bridge explicitly documents that behavior for its exact version.
6. Validate, accept, and roll back
Use a tiny copy of a real .ui file and record this matrix:
| Check | Pass condition |
|---|---|
| Interpreter | sys.executable points inside the intended environment. |
| Dependencies | python -m pip check reports no broken requirements. |
| PyQt5 import | python -c "from PyQt5 import uic; print(uic.__file__)" points inside that environment. |
| Conversion | pyuic5 or the API script creates a new Python file without altering the .ui source. |
| Syntax | python -m py_compile .\ui_form_generated.py succeeds. |
| Application | The generated form imports and opens under the project’s own smoke test. |
| Designer, if required | The same environment’s wrapper launches Designer and View Code produces the expected language. |
Accept the repair only when every required row passes twice from a fresh shell. If the sibling environment fails, deactivate it and point the IDE back to the untouched old interpreter; the captured inventories remain evidence. Keep the old environment until the project test suite and one normal development session pass.
Common brittle fixes to avoid
- Hard-linking or copying
uic.exeinto an undocumentedsite-packagessubdirectory. - Copying
pyuic5.exefrom one environment to another. - Editing a generated Windows launcher or assuming every launcher failure is a text shebang problem.
- Installing into Conda
base, usingpip --userinside Conda, or mixing multiple environments on globalPATH. - Reinstalling PyQt5, Qt, Designer, and plugins together before preserving versions and the original error.
- Treating Designer View Code as the only way to produce Python from a
.uifile.
Primary documentation
- Riverbank: Using Qt Designer with PyQt5
- Riverbank: `PyQt5.uic` module and `compileUi()`
- Qt 5.15: Using a Designer UI file in a C++ application
- Python Packaging Authority: entry-point command wrappers
- pip: `pip show –files`
- pip: `pip check`
- Conda: managing and recreating environments
- Microsoft: `Get-Command`
- Microsoft: `Test-Path`
- Microsoft: `fsutil hardlink`
- `pyqt5-tools` project metadata and usage on PyPI
Original 2019 post (complete archive)
Archive provenance: The following body is copied from
out/posts/2019-05-01-unable-to-launch-cminiconda3libsite-packagespyqt5_toolsbinuic-exe-1925/index.md, post ID1925, dated 2019-05-01. It preserves the complete visible text, spelling, capitalization, relative image path, and incorrect hard-link claim; only invisible trailing whitespace is normalized for repository formatting. Do not follow it as current guidance.
When I use Qt Designer, I want to view the corresponding python or c code(Form > View Code). However, the installed qt-designer cannot find uic module. I found the uic moudle(uic.exe) located in
C:\Miniconda3\Lib\site-packages\pyqt5_tools\uic.exe
and the pyuic5 executable (pyuic5.exe) located at
C:\Miniconda3\Scripts\pyuic5.exe
In windows, we cannot create hard link, so I installed Hard Link Shell. Then I hard-linked those excutables to the path qt-designer used. Finally, it works like a charm.

