Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8231889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:38:44+00:00 2026-06-07T17:38:44+00:00

Using the latest pyinstaller on Windows 7 to make a standalone exe (-F), when

  • 0

Using the latest pyinstaller on Windows 7 to make a standalone exe (-F), when running the exe:

ImportError: cannot import name QtGui

In the pyinstaller hooks directory there is special handling for PyQt4 though not PySide.

Hoping for a workaround for this or something to try.

Environment
Windows 7 64-bit
Python 2.7 32-bit
PYTHONHOME=c:\python27
PYTHONPATH=c:\python27\lib
PYTHONLIB=c:\python27\libs\python27.lib;c:\python27\lib\site-packages

Steps
1. Add PySide from http://releases.qt-project.org/pyside/1.1.1/PySide-1.1.1qt474.win32-py2.7.exe
2. Unzip https://github.com/pyinstaller/pyinstaller/zipball/develop to c:\pyinstaller1.5.1
3. Run the commands below against a .py file containing simply:

from PySide import QtGui

[…or QtCore or or.]

Run

c:\pyinstaller1.5.1>pyinstaller.py -F import_test.py
108 INFO: wrote c:\pyinstaller1.5.1\import_test.spec
171 INFO: Testing for ability to set icons, version resources...
296 INFO: ... resource update available
312 INFO: UPX is not available.
4321 INFO: checking Analysis
4382 INFO: checking PYZ
4430 INFO: checking PKG
4446 INFO: building because c:\pyinstaller1.5.1\build\pyi.win32\import_test\import_test.exe.manifest changed
4446 INFO: building PKG out00-PKG.pkg
16782 INFO: checking EXE
16782 INFO: rebuilding out00-EXE.toc because pkg is more recent
16782 INFO: building EXE from out00-EXE.toc
16799 INFO: Appending archive to EXE c:\pyinstaller1.5.1\dist\import_test.exe

c:\pyinstaller1.5.1>dist\import_test.exe
Traceback (most recent call last):
  File "<string>", line 23, in <module>
ImportError: cannot import name QtGui

Note

At the end of the PySide install (as admin), this message:
    close failed in file object destructor:
    sys.excepthook is missing
    lost sys.stderr
If that is about post install it can be handled manually:
    c:>python.exe c:\Python27\Scripts\pyside_postinstall.py -install
    Generating file C:\python27\qt.conf...
    PySide installed in c:/python27/Lib/site-packages/PySide...
    The PySide extensions were successfully installed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T17:38:45+00:00Added an answer on June 7, 2026 at 5:38 pm

    Workaround. This worked:

    # Various imports, whatever, using normal sys.path, for example:
    import os, sys, re, time, random
    import subprocess, psutil
    
    # Save sys.path
    sys_path_saved = sys.path
    
    # Limit sys.path for PySide import
    sys.path = ['c:\\python27\\lib\\site-packages']
    
    # PySide imports with limited sys.path
    from PySide        import QtGui, QtCore
    from PySide.QtGui  import QApplication, QLineEdit
    from PySide.QtCore import QSettings, Qt
    
    # Reset sys.path to original
    sys.path = sys_path_saved
    
    # Remainder of code...
    

    Pyinstaller 1.5.1 should do a fine job of locating dependencies, and often does.
    However, all of many many attempts to use its pathex or hiddenimports in .spec failed.
    Modifying my environment variables also failed.
    Extracting various module files manually from from .egg sometimes worked.

    However for PySide imports, the sys.path temporary limitation above was the workaround that worked.

    Update: Unfortunately the exe only works on a machine with Python/Pyside installed, doesn’t work on XP without Python.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using latest version of R/xts/zoo on Windows: R 2.15, xts 0.8-6, zoo 1.7-7
Using latest CTP5 with async/await keywords, I wrote some code, which apparently cannot compile:
Using latest JAXB (Sun) and have a hierarchy of schemas that use import directives
I am using latest Pyramid to build a web app. Somehow we have started
I'm using latest MVC4-RC (.net 4.0) with Microsoft ASP.NET Web Optimization Framework http://nuget.org/packages/Microsoft.AspNet.Web.Optimization/1.0.0-beta3 and
I am using latest Google IMA SDK for video ads, in that the flash
Does anybody using latest enterprise library 4.1 in mono? I used mono migration analyzer
Currently I'm building an application using latest Prism for Silverlight 4. I've a module
Using the latest version of Resharper (4.5.x) with VS2008. Every now and then (pretty
I'm using the latest version of the jquery plugin DataTables and I tried to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.