Giter Site home page Giter Site logo

pyinstaller / pyinstaller Goto Github PK

View Code? Open in Web Editor NEW
11.4K 232.0 1.9K 60.59 MB

Freeze (package) Python programs into stand-alone executables

Home Page: http://www.pyinstaller.org

License: Other

Python 69.54% C 29.91% Shell 0.37% TeX 0.05% Batchfile 0.01% Dockerfile 0.12% SWIG 0.01%
python python-3 bundle package pyinstaller python-to-exe py2exe py2app

pyinstaller's Introduction

PyInstaller Overview

PyPI PyPI - Python Version Read the Docs (version) PyPI - Downloads

PyInstaller bundles a Python application and all its dependencies into a single package. The user can run the packaged app without installing a Python interpreter or any modules.

Documentation:https://pyinstaller.org/
Code:https://github.com/pyinstaller/pyinstaller

PyInstaller reads a Python script written by you. It analyzes your code to discover every other module and library your script needs in order to execute. Then it collects copies of all those files -- including the active Python interpreter! -- and puts them with your script in a single folder, or optionally in a single executable file.

PyInstaller is tested against Windows, macOS, and GNU/Linux. However, it is not a cross-compiler: to make a Windows app you run PyInstaller in Windows; to make a GNU/Linux app you run it in GNU/Linux, etc. PyInstaller has been used successfully with AIX, Solaris, FreeBSD and OpenBSD, but is not tested against them as part of the continuous integration tests.

Main Advantages

  • Works out-of-the-box with any Python version 3.8-3.12.
  • Fully multi-platform, and uses the OS support to load the dynamic libraries, thus ensuring full compatibility.
  • Correctly bundles the major Python packages such as numpy, PyQt5, PySide2, PyQt6, PySide6, wxPython, matplotlib and others out-of-the-box.
  • Compatible with many 3rd-party packages out-of-the-box. (All the required tricks to make external packages work are already integrated.)
  • Works with code signing on macOS.
  • Bundles MS Visual C++ DLLs on Windows.

Installation

PyInstaller is available on PyPI. You can install it through pip:

pip install pyinstaller

Requirements and Tested Platforms

  • Python:
    • 3.8-3.12. Note that Python 3.10.0 contains a bug making it unsupportable by PyInstaller. PyInstaller will also not work with beta releases of Python 3.13.
  • Windows (32bit/64bit/ARM64):
    • PyInstaller should work on Windows 7 or newer, but we only officially support Windows 8+.
    • Support for Python installed from the Windows store without using virtual environments requires PyInstaller 4.4 or later.
  • Linux:
    • GNU libc based distributions on architectures x86_64, aarch64, i686, ppc64le, s390x.
    • musl libc based distributions on architectures x86_64, aarch64.
    • ldd: Console application to print the shared libraries required by each program or shared library. This typically can be found in the distribution-package glibc or libc-bin.
    • objdump: Console application to display information from object files. This typically can be found in the distribution-package binutils.
    • objcopy: Console application to copy and translate object files. This typically can be found in the distribution-package binutils, too.
    • Raspberry Pi users on armv5-armv7 should add piwheels as an extra index url then pip install pyinstaller as usual.
  • macOS (x86_64 or arm64):
    • macOS 10.15 (Catalina) or newer.
    • Supports building universal2 applications provided that your installation of Python and all your dependencies are also compiled universal2.

Usage

Basic usage is very simple, just run it against your main script:

pyinstaller /path/to/yourscript.py

For more details, see the manual.

Untested Platforms

The following platforms have been contributed and any feedback or enhancements on these are welcome.

  • FreeBSD
    • ldd
  • Solaris
    • ldd
    • objdump
  • AIX
    • AIX 6.1 or newer. PyInstaller will not work with statically linked Python libraries.
    • ldd
  • Linux on any other libc implementation/architecture combination not listed above.

Before using any contributed platform, you need to build the PyInstaller bootloader. This will happen automatically when you pip install pyinstaller provided that you have an appropriate C compiler (typically either gcc or clang) and zlib's development headers already installed.

Support

Changes in this Release

You can find a detailed list of changes in this release in the Changelog section of the manual.

pyinstaller's People

Contributors

bjones1 avatar bobotig avatar bwoodsend avatar chrisg2000 avatar codewarrior0 avatar danyeaw avatar dhyams avatar dvarrazzo avatar glennra avatar htgoebel avatar hugovk avatar iikoe avatar legorooj avatar leycec avatar linusg avatar lmancini avatar lvillani avatar matysek avatar naufraghi avatar pyup-bot avatar rasky avatar rokm avatar ronaldoussoren avatar rugginoso avatar springermac avatar stephenrauch avatar thomaswaldmann avatar virtuald avatar williamcaban avatar xoviat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyinstaller's Issues

hook-distutils.py does text read on binary file

Original date: 2010/03/18
Original reporter: *peter AND engcorp DOT COOM *

The code in source:trunk/hooks/hook-distutils.py is opening a .pyc file with mode "r" instead of "rb". This cannot work. Changing it to "r" fixes the problem.

sprintf(cmd, "sys.path.insert(0, '%s')", tmp) fails if string "tmp" contains a single quote character

Original date: 2010/05/28
Original reporter: Wang Ding Wei

source\common\launch.c, line 669:

  sprintf(cmd, "sys.path.insert(0, '%s')", tmp);

This will cause failures like the one below๏ผš

E:\>check_os.exe
  File "<string>", line 1
   sys.path.insert(0,'C:/Users/James'/AppData/Local/Temp/_MEI43442')
                                                                  ^
SyntaxError: EOL while scanning string literal

If there is a single quote in the user name, the one-file mode will fail.

Windows doesn't allow double quote in an file name, so change the single quote to double quote in launch.c will fix it.

For Linux it may be a little tricky, since both single quote and double quote are allowed in file names, but maybe Linux users are smarter and will never use special characters in file names?

Bug in Make.py

Original date: 2010/08/27

String 'darwin' in line 57 of the file source/linux/Make.py is 6 and not 7 characters long. The correct code should look like:

         ...
         sys.platform[:6] in ('cygwin','darwin') or
         sys.platform[:7] == 'freebsd' ):
         ...

bindepend.py doesn't work with Python v2.2 and earlier

Original date: 2010/09/06
Original reporter: simon DOT meier AND web DOT de

Module bindepend.py of PythonInstaller V1.4 is incompatible with Python v2.2 in line 332.

PythonInstaller V1.4:

if npth.find('libpython') != -1 and npth.find('Python.framework') != -1:

causes the error:
"TypeError: 'in ' requires character as left operand"
in Python v2.2 and earlier.

Better use

if npth.find('libpython') != -1 and npth.find('Python.framework') != -1:

to be compatible with earlier versions.

Greetings,
Simon

PyQt applications not focusing on launch on Mac OS-X

Original date: 2010/03/01

PyQT applications are not focusing on launch on Mac OS-X. Often the app window is hidden behind others. The issue still occurs when the apps are bundled by pyinstaller.

From a thread on the Pyqt mailing list:

"Every pyqt example I start under Mac OS X (PyQt 4.5.4, Python 2.6 from
Python.org, Mac OS X 10.5.8), no matter which (I tried the delivered examples in the source distribution and also the examples from the python book [1], I also tried the eric IDE and spyder) fail to receive the focus when launched. A click is needed to raise the application. Sometimes the newly opened window
is hidden under others."

hello = HelloWorld()
hello.show()
hello.raise_() # this will raise the window on Mac OS X
sys.exit(app.exec_())

Given it's a Mac-only problem, which wasn't reproducible with Qt, only
PyQt, for me it looks like a PyQt bug. But the fix is quite easy." http://www.mail-archive.com/[email protected]/msg18943.html

Could pyinstaller incorporate a fix (or an option) for this issue, ensuring that a Pyqt app will receive the focus upon launch?

Syntax error in formlayout.py

Original date: 2010/08/27

Syntax error in formlayout.py
('invalid syntax', ('formlayout.py', 275, 49, '                field.setCheckState(Qt.Checked if value else Qt.Unchecked)\n'))
   co = compile(string.replace(stuff, "\r\n", "\n"), py[0], 'exec')
  File "formlayout.py", line 275
    field.setCheckState(Qt.Checked if value else Qt.Unchecked)

Makespec.py deletes the content of target scriptfile, then claims it's not there

Original date: 2010/04/07
Original reporter: sano98

Configure runs fine, says it cannot determine Windows or System
directories (Windows 7, 64) but finishes the config.dat.

But when trying to build the specfile, it raises the error:
Makespec.py: error: Requires at least one scriptname file

The given python script then magically has the size 0 KB and no further content. (I believe a file of that name is newly created without content, because when trying to give Makespec a file which does not exist, the one is created (with no content) and the same error arises).

I am getting this right that you're supposed to give Makespec the path and name of the file you want to be converted, correct?! How else should the installer know what I want to convert?

What's even stranger: Sometimes the specfile is created - but then Build claims that there is no specfile.

problem with matplotlib

Original date: 2010/11/06

Hello everybody,

I am using PyInstaller to generate a set of stand-alone unix-like python utilities to be distributed within a research group. These utilities are simple but rely on many libraries sometime not so easy to install (scipy, matplotlib, etc.). I am working with a Mac OSX 10.6.2 and python 2.6.1.
In most cases PyInstall does a nice job. There are however problems when matplotlib is involved (as usual, I'd say...).
I report below the error I read:

./SRPCosmology 
WARNING: astImages: failed to import matplotlib - some functions will not work.
Traceback (most recent call last):
  File "<string>", line 22, in <module>
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 436, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 521, in doimport
    exec co in mod.__dict__
  File "/Users/covino/Desktop/SRP/build/pyi.darwin/SRPCosmology/outPYZ1.pyz/astLib", line 16, in <module>
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 436, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 521, in doimport
    exec co in mod.__dict__
  File "/Users/covino/Desktop/SRP/build/pyi.darwin/SRPCosmology/outPYZ1.pyz/astLib.astPlots", line 42, in <module>
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 436, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 521, in doimport
    exec co in mod.__dict__
  File "/Users/covino/Desktop/SRP/build/pyi.darwin/SRPCosmology/outPYZ1.pyz/pylab", line 1, in <module>
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 436, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 521, in doimport
    exec co in mod.__dict__
  File "/Users/covino/Desktop/SRP/build/pyi.darwin/SRPCosmology/outPYZ1.pyz/matplotlib.pylab", line 247, in <module>
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 436, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 521, in doimport
    exec co in mod.__dict__
  File "/Users/covino/Desktop/SRP/build/pyi.darwin/SRPCosmology/outPYZ1.pyz/matplotlib.pyplot", line 78, in <module>
  File "/Users/covino/Desktop/SRP/build/pyi.darwin/SRPCosmology/outPYZ1.pyz/matplotlib.backends", line 25, in pylab_setup
  File "/Users/covino/Pacchetti/pyinstaller-1.4/iu.py", line 455, in importHook
    raise ImportError, "No module named %s" % fqname
ImportError: No module named matplotlib.backends.backend_macosx

Do you know what I could try to solve the problem or whether at least could there be a workaround?

Thanks a lot,
Stefano

test-zipimport* failures on Linux

Original date: 2010/04/29
Original reporter: *MrJean1 AND Gmail DOT COOM *

Both PyInstaller 1.4 tests test-zipimport{1,2} fail on 32-bit CentOS 4.7 linux, see the attached log. These tests both pass on MacOS X Tiger (10.4.11).

Pyinstaller doesn't work properly with threading.Thread module

Original date: 2010/05/06
Original reporter: *jackson AND jacksonc DOT COOM *

A program that scans wifi networks using the threading.Thread module doesn't work, so I stripped the program down until I found where execution wasn't as expected. And it seems that things go weird when they enter the threading.Thread.run() method. After building the following code...

import threading

class TestThreadClass(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)

    def run(self):
        print 'ONE'
        print 'TWO'
        print 'THREE'

TestThreadClass().start()

When executed from the terminal in Ubuntu 10.04 and Python 2.6.5 it consistently prints "ONE\nTWO\nTHREE". But when built with PyInstaller (latest SVN as of 7th May), if I run the program over and over I get different output every time.

eg...

jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
ONE

TWO
THREE
jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
ONEjackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
ONE

TWO
jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
ONE

jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
ONE

jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
ONE

TWO
jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ ./test-obscure-bug 
jackson@jackson-laptop:~/Desktop/obscure-bug/dist/test-obscure-bug$ 

user defined lib search path

Original date: 2010/03/06
Original reporter: *animator333 AND yahoo DOT COOM *

The details are here:

http://groups.google.com/group/pyinstaller/browse_thread/thread/c3c90f005eb76035

By default pyinstaller copies all the libraries(.lib & .so) in the same directory where the .exe/.so resides. The proposal here to add an option (preferably in spec file) to mentioned user defined path to search for library.

For example:

libpath="/lib" (relative path)
or
libpath="%PATH%" (Using environment variable)

If libpath is not set then by default, all the libs should be copied in the same directory, where exe resides.

Thanks

Prashant

Python 2.7 support (ValueError: 'JUMP_IF_FALSE' is not in list)

Original date: 2010/08/27

Traceback (most recent call last):
  File "C:\Documents and Settings\My Documents\Downloads\trunk-r854\trunk\Configure.py", line 31, in <module>
    import mf
  File "C:\Documents and Settings\My Documents\Downloads\trunk-r854\trunk\mf.py", line 817, in <module>
    JUMP_IF_FALSE = dis.opname.index('JUMP_IF_FALSE')
ValueError: 'JUMP_IF_FALSE' is not in list
Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32

pyinstaller trunk-r854
Configure.py ends with an error.

Configurable policy for importing external Python files

Original date: 2010/03/15

Currently, PyInstaller adds the executable's directory to the sys.path, making it possible to import external Python files. This is very useful in some scenarios (eg: external plugins) but other people find that it is even a security problem (since attackers can inject code by adding files on the filesystem and relying on modules that are correctly missing; eg: posix.py on a Windows system).

After [770], users that are aware of this can remove the executable's directory from sys.path at runtime to avoid imports of external files. This is of course sub-optimal (especially since most Python programmers are unfamiliar with import internals).

I think that PyInstaller should simply let the user decide about which behaviour he wants, through the spec file.

PYTHONPATH being overwritten instead of concatenated

Original date: 2010/05/23
Original reporter: anonymous

If the PYTHONPATH env var has been set in the OS then it should be concatenated with the PYTHONPATH that pyinstaller is setting instead of overwriting it (which seems to be the current implementation). I'm seeing this with Python 2.6.4,I know that Python2.6 isn't supported but it is working for my needs. I haven't had a chance to try it with Python 2.5.

Thanks!

Remove existing output directory when building

Original date: 2010/03/02
Original reporter: florian DOT hoech AND gmx DOT de

This patch makes pyinstaller remove an existing output directory when running Build.py. To do this in a safe way, it checks if the output directory already exists, and if not empty, the user gets a warning that it (and all its contents) will be removed, with the choice to continue or abort (or if sys.stdout is not connected to a tty, it will error out). It will also check if the output directory is the same as the directory containing the specfile or build directory, or if the output directory is contained within those directories, and error out in that case. Otherwise, the output directory is removed using rmtree.

Exception throws for conditionally imported module

Original date: 2010/08/17
Original reporter: devel AND sumpfralle DOT de

Hi,

I just created an exe-file out of a python program. It was awefully easy - thanks!

But during the execution of the resulting binary an exception was thrown in iu.py at line 454. The "del sys.module[fqname]" statement there threw a KeyError.

I added a "if fqname in sys.module:" statement before this line. This seems to have fixed the problem.

The module in question was loaded in my program via "try ... except ImportError". Since the module was not available at runtime, it was not added to the "sys.module" dictionary.

I guess, the above fix with the "if" statement is clean and should cause no harm.

thanks for your work,
Lars

Installer GUI

Original date: 2010/07/28
Original reporter: *waynejwerner AND gmail DOT COOM *

This is a really (really) simple Tkinter based gui that provides input for a source file, and a directory for the output exe. It takes care of the most basic needs.

Django 1.2.1 hook module needs updating

Original date: 2010/08/04
Original reporter: CBWhiz

hooks-django.db.backends.py:

add
hiddenimports.append('django.db.models.sql.compiler')
just before the return mod statement.

hookutils.exec_statement() uses hard-coded ':' as PYTHONPATH separator

Original date: 2010/06/21
Original reporter: *riccardo DOT vianello AND gmail DOT COOM *

Hello,

In joining PYTHONPATH with pathex, a ':' character is used on all platforms. On Windows I think this may cause an import error in the executed statement (followed e.g., by a SyntaxError in qt4_plugins_dir() when eval is called on the returned empty output).

test15 fails on MacOS X

Original date: 2010/04/29
Original reporter: *MrJean1 AND Gmail DOT COOM *

Even after fixing 3 typos in the test15.spec file, the test still fails on MacOS X Tiger (10.4.11), see the attached log.

The test passes on 32-bit CentOS 4.7 using the modified test15.spec.

Simplify bootloader compilation on Windows

Original date: 2010/03/13

Currently, compiling the bootloader under Windows requires the Scons tool and two different versions of Visual Studio. This is because originally the bootloader required to be compiled with the same compiler Python is built with.

But lately, this has changed. The bootloader is now built statically and it does not depend on Python anymore. Thus, any version of any compiler capable of doing a static executable is enough.

We should thus drop a lots of code from Sconscript to open up compilation to a larger number of compilers. We could also revisit the choice of Scons in favor of more mainstream tools (eg: cmake).

Multi-executable support

Original date: 2010/03/15

PyInstaller should grow support for packing programs made of multiple executables.

Currently, there is no way to leverage common parts between multiple executables. Each executable must be build isolated from the others:

  • In one-dir mode, dynamic libraries will be reused because they sit on the filesystem, but all Python modules will be duplicated within the two executables.
  • In one-file mode, all dynamic libraries and modules are duplicated within each executable.

It is possible to do much better than this, and let each executable reuse parts extracted from other executables.

importing pyodbc fails

Original date: 2010/04/20
Original reporter: l DOT quesada AND 4c DOT ucc DOT ie

Dear all,

It seem pyInstaller is not able to build executable files for programs that use python-zibopt.

In order to reproduce the problem, after installing python-zibopt (following the instructions in http://code.google.com/p/python-zibopt/wiki/Installation ), try to build an executable for for examples/sudoku.py.

Notice that you can download the required tgz files from:
http://python-zibopt.googlecode.com/files/python-zibopt-0.5.beta-r97....
http://zibopt.zib.de/download.shtml

Cheers,
Luis

Segmentation fault when using executable on another machine

Original date: 2010/08/10
Original reporter: anonymous

Hi,
I'm facing a pretty peculiar issue. I'm using pyInstaller to create linux binaries. My build and target system are identical in terms of OS, hardware etc.

Once I create my executable (using shared python to handle dependencies better), the executable works perfectly fine on my local machine.
When I run this executable on another machine, it fails on a particular command :

status,out = commands.getstatusoutput("ant -f build.xml")

Commands is a python package which I use to run unix commands from my python program.

The program still continues and finishes, but the previous command returns a segmentation fault.

if i run my python program on this target machine using python test.py, it works fine again.
I have attached my spec file to the bug.

Is there anyway I can debug why I get a segmentationFault in the executable ?
Version of pyInstaller : 1.4

Hook file for lxml.objectify

Original date: 2010/03/13
Original reporter: *raoul DOT snyman AND gmail DOT COOM *

A hook file for the lxml.objectify module.

Multiprocessing code fails when using a onefile executable on win32

Original date: 2010/05/04
Original reporter: jkp AND kirkconsulting DOT co DOT uk

I've had a problem for a long-while in some code that uses the multiprocessing module to co-oridinate multiple subprocesses. The code works fine without PyInstaller involved, but when I package it as a PyInstaller onefile executable I find that all kinds of errors are thrown when using cross-process constructs such as semaphores etc.

I spent some time tracking down the issue today have boiled it down to the following:

  • I've implemented a simple test script that when packaged as a onefile executable illustrates the problem.
  • The issue seems to be solveable by commenting out the line in launch.c that resets the _MEIPASS2 environment variable before running the packaged scripts. With this environment variable present PyInstaller does not try to extract things again for subprocesses since this is already done (which seems like the correct behaviour).

The offending line was originally added here: http://www.pyinstaller.org/changeset/571. I'm not sure what the reasoning behind this existing is but it certainly breaks multiprocessing. Is there a better solution that I don't know of? Why is this line required?

I've attached the testcase code so that someone else can reproduce the issue and perhaps suggest what should be done.

http://www.pyinstaller.org/changeset/571

Add import-hook for scapy

Original date: 2010/08/27

I am trying to convert a testtoexe.py (which imports scapy and paramiko) file to exe. I am running Python2.6 (in PythonWin) on Windows XP.
I am using pyinstaller1.4

I am able to convert the .py to .exe, but.....
I get the following error when I run the exe:

C:\automation\createexe\dist>testtoexe.exe
['C:/DOCUME~1/arinc/LOCALS~1/Temp/_MEI4842', 'C:/automation/createexe/dist', 'C:\\automation\\createexe\\dist\\testtoexe.exe?94208']
WARNING: No route found for IPv6 destination :: (no default route?)
Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "C:\automation\pyinstaller\iu.py", line 436, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "C:\automation\pyinstaller\iu.py", line 521, in doimport
    exec co in mod.__dict__
  File "C:\automation\createexe\build\pyi.win32\testtoexe\outPYZ1.pyz/scapy.all", line 37, in <module>
  File "C:\automation\pyinstaller\iu.py", line 436, in importHook
    mod = _self_doimport(nm, ctx, fqname)
  File "C:\automation\pyinstaller\iu.py", line 521, in doimport
    exec co in mod.__dict__
  File "C:\automation\createexe\build\pyi.win32\testtoexe\outPYZ1.pyz/scapy.layers.all", line 16, in <module>
  File "C:\automation\createexe\build\pyi.win32\testtoexe\outPYZ1.pyz/scapy.layers.all", line 10, in _import_star
  File "C:\automation\pyinstaller\iu.py", line 455, in importHook
    raise ImportError, "No module named %s" % fqname
ImportError: No module named inet
C:\automation\createexe\dist>

I give the following commands in command line to convert py to exe:

>python Configure.py
>python Makespec.py -o C:\automation\createexe -F C:\automation\atg\GeneralFiles_AC\testtoexe.py
>python Build.py C:\automation\createexe\testtoexe.spec

win32com.gen_py issue persists in 1.4

Original date: 2010/04/02
Original reporter: *barton AND bcdesignswell DOT COOM *

Despite a patch submission in 2006 found on
http://osdir.com/ml/python.pyinstaller/2006-02/msg00069.html
frozen apps fail to locate the win32com.gen_py directory when win32com.client.gencache.EnsureDispatch is called to create interface files.

I have applied the patch to my pyinstaller-1.3 to solve the problem.

--- win32comgenpy1.1.py Mon Sep 12 06:33:10 2005
+++ win32comgenpy.py Sun Feb 19 07:28:40 2006
@@ -34,6 +34,7 @@
import win32com
win32com.__gen_path__ = genpydir
win32com.__path__.insert(0, supportdir)
+sys.modules["win32com.gen_py"].__path__ = [ win32com.__gen_path__ ]
# for older Pythons
import copy_reg

_pyi_egg_install.py may get bundled even if there are no eggs

Original date: 2010/05/13
Original reporter: *cowo78 AND gmail DOT COOM *

_pyi_egg_install.py calls os.listdir() to list available packages in eggs/ directory. However if eggs/ directory is not present it raises an exception.
So it's an idea to substitute:

for fn in os.listdir(d):
sys.path.append(os.path.join(d, fn))

with

if os.path.isdir(d):
for fn in os.listdir(d):
sys.path.append(os.path.join(d, fn))

sys.platform checks

Original date: 2010/04/29
Original reporter: *MrJean1 AND Gmail DOT COOM *

There are 3 locations in the PyInstaller 1.4 code with incorrect sys.platform tests for 'darwin'. There are 6 characters in 'darwin' and not 7 characters.

Also, using sys.platform[:6] == 'darwin' or sys.platform.startswith('darwin') makes the PyInstaller code future proof for 'darwin64'.

Attached is a file showing all occurances of sys.platform in the PyInstaller 1.4 Python source.

IOError: Python library not found!

Original date: 2010/03/24
Original reporter: jianjianjiao

Hi all:
A problem goes as follows when I use pyinstaller 1.4(Python version: 2.6.5):
urgly waiting for your help, thx in advance! :-)

File "Build.py", line 1160, in
main(args[0], configfilename=opts.configfile)
File "Build.py", line 1148, in main
build(specfile)
File "Build.py", line 1111, in build
execfile(spec)
File "/home/work/_files/pyinstaller-1.4/helloworld/helloworld.spec", line 3, in
pathex=['/home/work/_files/pyinstaller-1.4'])
File "Build.py", line 245, in init
self.postinit()
File "Build.py", line 196, in postinit
self.assemble()
File "Build.py", line 348, in assemble
self.fixMissingPythonLib(binaries)
File "Build.py", line 396, in fixMissingPythonLib
raise IOError("Python library not found!")
IOError: Python library not found!

Multiple mains in --onedir

Original date: 2010/04/15
Original reporter: *MrJean1 AND Gmail DOT COOM *

Would it be possible to build several main binaries with --onedir such that the resulting directory contains one copy of each binary and combination of all shared libraries used by those mains?

We tried running Makespec.py --onedir main1.py main2.py main3.py .... and that did seem to produce the desired result. Instead, only main1 binary is built and there are no other mains.

Provide a simpler way to access data files

Original date: 2010/03/12

Currently, accessing data files is harder than it should be, because _MEIPASS2 is only set in one-file mode; thus, people have to recur to ifs (also runtime hooks).

The bootloader should export an environment variable called something like "_PYI_WORKDIR" which points to either the temporary directory in onefile mode or the directory where the executable is in onedir mode.

hookutils.exec_statement() vs wine

Original date: 2010/07/27
Original reporter: anonymous

i get an IOError (permission denied) on wine when hookutils.exec_statement() tries to read the tempfile it created. file permissions are ok, so no idea why.

txt = open(fnm, 'r').read()[:-1]
>>IOError: [Errno 13] Permission denied

pyinstaller-r854
wine-1.1.42

Error changing SIP API version

Original date: 2010/11/05

SIP must be loaded and API changed (with sip.setapi()) before Qt is
loaded. Unfortunately, currently this cannot be done in the program that is going to be converted to an executable, because PyInstaller needs to configure Qt's plugin directory before the application starts.
This happens in support/rthooks/pyi_rth_qt4plugins.py

-Possible solution:*[[BR]]
Add an internal post-import-hook, that is a callable that is invoked just after a module is imported. Then the code to configure the plugin paths can be registered so that is called just
after PyQt4.QtCore is imported.

All PyQt apps give Error: 'qt_menu.nib could not be loaded' on OS-X

Original date: 2010/02/28
Original reporter: *chriswayg AND gmail DOT COOM *

Trying to run any Pyqt app bundled by pyinstaller will give the following error on OS-X:

Qt internal error: qt_menu.nib could not be loaded. The .nib file should be placed in QtGui.framework/Versions/Current/Resources/ or in the resources directory of your application bundle.

This error does not occur when running the python scripts conventionally, before it is packaged by pyinstaller.

My current workaround is to copy the file Library/Frameworks/QtGui.framework/Versions/4/Resources/qt_menu.nib to Appname.app/Contents/Resources

This allows the Pyqt applications to run. I wonder though, if this is the right way of doing this.

If pyinstaller supports Pyqt on OS-X, shouldn't the appropriate .nib file be automatically included or referenced?


Version Numbers: Pyinstaller SVN revision 771, OS-X 10.6.2, Python 2.6.1, Qt 4.6.2., Pyqt 4.7, sip 4.10, QScintilla 2.4.2

UPX on mac doesn't do anything?

Original date: 2010/04/28
Original reporter: *xiao AND xiao DASH yu DOT COOM *

Hi,

I built my PyQt/PIL application with and without UPX on Mac OS X. However, in both case, the final executable is exactly the same size.
Even though while building, it says
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2009
UPX 3.04 Markus Oberhumer, Laszlo Molnar & John Reiser Sep 27th 2009

    File size         Ratio      Format      Name

 38312 ->     14719   38.42%   Mach/AMD64    run                           

Packed 1 file.
Appending archive to EXE Tagxter/dist/Tagxter
checking BUNDLE
I'm not sure where that 14719 went. In both .app/Contents/MacOS and in dist, the file size is 32,667,793 bytes.

If I did something retarded, please don't destroy me. I'm a n00b

Makespec.py deletes the content of target scriptfile, then claims it's not there

Original date: 2010/04/07
Original reporter: sano98

Configure runs fine, says it cannot determine Windows or System
directories (Windows 7, 64) but finishes the config.dat.

But when trying to build the specfile, it raises the error:
Makespec.py: error: Requires at least one scriptname file

The given python script then magically has the size 0 KB and no further content. (I believe a file of that name is newly created without content, because when trying to give Makespec a file which does not exist, the one is created (with no content) and the same error arises).

I am getting this right that you're supposed to give Makespec the path and name of the file you want to be converted, correct?! How else should the installer know what I want to convert?

What's even stranger: Sometimes the specfile is created - but then Build claims that there is no specfile.

pycrypto egg with python 2.6 on win32 - UnboundLocalError

Original date: 2010/10/09

Hi there,

I'm trying to build an application, that includes pycrypto, and I hit the following error. I don't know anything about PyInstaller internals, nor I have time to learn it, so at least maybe the log file will help you fixing this bug...

I: Skipping mscoree.dll dependency of msvcm90.dll
I: Analyzing C:\Windows\system32\python26.dll
I: Dependent assemblies of C:\Windows\system32\python26.dll:
I: x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none
I: Skipping KERNEL32.dll dependency of python26.dll
I: Skipping USER32.dll dependency of python26.dll
I: Skipping ADVAPI32.dll dependency of python26.dll
I: Skipping SHELL32.dll dependency of python26.dll
I: Analyzing C:\Python26\lib\site-packages\pycrypto-2.0.1-py2.6-win32.egg\Crypto
/Cipher/AES.pyd
Traceback (most recent call last):
  File "Build.py", line 1291, in <module>
    main(args[0], configfilename=opts.configfile)
  File "Build.py", line 1269, in main
    build(specfile)
  File "Build.py", line 1232, in build
    execfile(spec)
  File "client\client.spec", line 3, in <module>
    pathex=['C:\\Users\\FHU Kagami\\Downloads\\branches\\py26win'])
  File "Build.py", line 292, in __init__
    self.__postinit__()
  File "Build.py", line 243, in __postinit__
    self.assemble()
  File "Build.py", line 405, in assemble
    platform=target_platform))
  File "C:\Users\FHU Kagami\Downloads\branches\py26win\bindepend.py", line 310,
in Dependencies
    for ftocnm, fn in selectAssemblies(pth):
  File "C:\Users\FHU Kagami\Downloads\branches\py26win\bindepend.py", line 376,
in selectAssemblies
    for assembly in getAssemblies(pth):
  File "C:\Users\FHU Kagami\Downloads\branches\py26win\bindepend.py", line 344,
in getAssemblies
    if RT_MANIFEST in res and len(res[RT_MANIFEST]):
UnboundLocalError: local variable 'res' referenced before assignment

Code-signed executables with Tk do not work

Original date: 2010/04/01

PyInstaller projects using Tk support (Makespec --tk) are broken when using code-signing.

There are two possible fixes here, and both should be eventually done:

  • Remove the explicit support for Tk and rely on the new infrastructure of data files from hooks to package Tk data files.
  • Make CArchive compatible with code-signed executables, for users attempting runtime extraction of data.

Compile the bootloader on Linux as a LSB binary

Original date: 2010/03/13

To reduce binary compatibility annoyance, it would be better to build the bootloader under Linux with LSB. At the same time, we could revamp the compilation support under Linux (Make.py and friends) which is mostly obsolete and replace it with something more mainstream (eg: cmake).

If we manage to really build a LSB executable, we could probably ship it in binary form just like we do on Windows, to make Linux users happier.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.