Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Minimal example of pyinstaller --onefile .so conflict

Minimal example to reproduce pyinstaller issue #1105

Problem with conflicting .so files

To reproduce:

  1. Download the gist

  2. Gist doesn't support directories, so manually create the submodule:

    $ mkdir submodule
    $ mv _random.pyx submodule/
  3. Use cython to compile the .so:

    $ python build_ext --inplace
  4. Run normally, it works:

    $ python
  5. Run through pyinstaller --onedir, it works:

    $ pyinstaller --onedir --name=onedir
    $ dist/onedir/onedir
  6. Run through pyinstaller --onefile, it fails:

    $ pyinstaller --onefile --name=onefile
    $ dist/onefile
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "/usr/local/lib/python2.7/site-packages/PyInstaller/loader/", line 270, in load_module
        exec(bytecode, module.__dict__)
      File "/Users/ronen/test/pyi_so_conflict/build/onefile/out00-PYZ.pyz/submodule", line 1, in <module>
    ImportError: cannot import name subfunc

Platform details:

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.10.1
BuildVersion:	14B25
$ python --version
Python 2.7.9
$ pyinstaller --version
from ._random import subfunc
def subfunc():
return True
import random
import submodule
if random.random() and submodule.subfunc():
print "success!"
from distutils.core import setup
from Cython.Build import cythonize
name = 'pyinstaller .so collision example',
ext_modules = cythonize("submodule/_random.pyx"),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.