QtWidgets.QMainWindow.__init__(self)
print('Setting up UI')
self.ui = Ui_MainWindow()
self.ui.setupUi(self)

def main():
    print('fired main()')
app = QtWidgets.QApplication(sys.argv)
window = Main()
window.show()
sys.exit(app.exec_())
if __name__ == '__main__':
    main()
How to install PyQt5 on a new virtualenv and work on an IDLE