Skip to content

Experiences with other packaging approaches

Mike Hucka edited this page Jun 17, 2018 · 1 revision

cx_Freeze

I attempted to produce a standalone application using cx_Freeze, but ultimately it became clear it won't work. After some effort, I managed to get the build_exe target working on macOS, but the result encountered this error at run-time:

60 active> cd build/exe.macosx-10.13-x86_64-3.5/                                                                                                            sbml/software/moccasin
61 active> ./moccasin                                                                                                                   moccasin/build/exe.macosx-10.13-x86_64-3.5
Traceback (most recent call last):
  File "/Users/mhucka/system/lib/python3.5/site-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
    module.run()
  File "/Users/mhucka/system/lib/python3.5/site-packages/cx_Freeze/initscripts/Console.py", line 26, in run
    exec(code, m.__dict__)
  File "moccasin/__main__.py", line 35, in <module>
  File "/Users/mhucka/project-files/sysbio/sbml/software/moccasin/moccasin/__init__.py", line 141, in <module>
    from .interfaces import moccasin_CLI, moccasin_GUI
  File "/Users/mhucka/project-files/sysbio/sbml/software/moccasin/moccasin/interfaces/moccasin_CLI.py", line 40, in <module>
    from moccasin.interfaces import moccasin_GUI
  File "/Users/mhucka/project-files/sysbio/sbml/software/moccasin/moccasin/interfaces/moccasin_GUI.py", line 27, in <module>
    import requests
  File "/Users/mhucka/system/lib/python3.5/site-packages/requests/__init__.py", line 98, in <module>
    from . import packages
  File "/Users/mhucka/system/lib/python3.5/site-packages/requests/packages.py", line 7, in <module>
    locals()[package] = __import__(package)
  File "/Users/mhucka/system/lib/python3.5/site-packages/idna/__init__.py", line 2, in <module>
    from .core import *
  File "/Users/mhucka/system/lib/python3.5/site-packages/idna/core.py", line 1, in <module>
    from . import idnadata
ImportError: cannot import name 'idnadata'

It seems that one of the packages that MOCCASIN depends on has an import statement involving a relative path and a submodule, but this does not work in the packaged-up application produced by cx_Freeze. The code is outside our control.

It might work to clone the package in question, modify the sources ourselves to work around the issue, and then include that in the MOCCASIN executable. This is perhaps feasible, but a maintenance nightmare in the long run. Moreover, I didn't even get to testing whether wxPython would work in this scenario.