Search code examples
pythonpysidepython-3.5pyinstallerimporterror

pyinstaller exe not running - No module named Pyside


My program works fine if run from Python.

I am now packaging this into an exe using Pyinstaller.

pyinstaller --onefile path/to/my/file.py

I am able to run the exe and so is anyone else if Python is installed on their system.

If Python is not installed, when the exe is run through terminal this error is seen:

ImportError: No module named 'Pyside'

The program does not use this module. The only libraries it uses are:

os, sys, glob, selenium, PyQt4, warnings

Installing and importing Pyside is not an option (I have tried this) as I am using Python 3.5.

Why is the created exe looking for the PySide module on a system without Python but not on a system with Python installed? Thanks

EDIT 1

It appears the issue is with PyQt4 as the below program will crash but a program with any of the other modules will run on a system without Python.

"""
Created on Mon Jan  9 09:23:13 2017
@author: me
"""
import PyQt4
print("This program simply tests if a packaged\npython program runs on your system!\n")
input("Press Enter to exit...")

EDIT 2

An example of the terminal output when the program is built.

enter image description here


Solution

  • The resolution to this was to roll the Python version back to a 3.4 distribution.

    Once the needed modules (PyQt4 and PyInstaller (v3.2)) were installed, PyInstaller was used without issue in the same way as before.

    The resulting exe was able to run on both systems with and without Python with no errors.

    Tracking of this issue for PyInstaller is here.

    Thank you