Using Qt Designer and PyQt5, I have made a simple app that does some simple modifications on a .txt file and saves it. I successfully compiled my program using PyInstaller with the following command:
pyinstaller --distpath DESTINATION_PATH --onefile --noconsole myscript.py
The executable is created, but when I try to run it, I get an error saying that the application failed to start because its side-by-side configuration is incorrect. If I do not use the --noconsole, the executable runs fine but this is not how I intend to run it. I am fairly new to PyQt5 and PyInstaller, and I read somewhere that my program should not include "subprocesses" when using --noconsole but I am not entirely sure what that means. If of any relevance, my antivirus was deleting the .exe when compiled with --onefile --noconsole but not when only using --onefile. However, this issue was soon solved by creating an exception.
Here are the imports I use:
import sys, re, os
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QFileDialog, QApplication, QMessageBox
from pathlib import Path
import pyperclip as pc
The answer provided above by ThePyGuy has solved the issue. Adding hiddenimports=['pyperclip']
in the spec file was enough to prevent the error from occuring and the program ran fine to the extent that I tested it.