Menu

#28 No success on freezing with nuitka (and how to freeze ?)

1.0
wont-fix
nobody
None
2015-09-10
2015-09-09
alfazaz
No

Hello !

I try to freeze my app which uses pygi on windows with nuitka and it doesn't work (no problem on linux). You can look at this on http://bugs.nuitka.net/issue242. I write this message because I don't know where is the problem (dependency walker on a really simple test case is on the latest link).

Is there a bug in pygi ? Is it my mistake ? (Optional question : how can I freeze an app that uses pygi on windows ? I didn't succeed with cx_freeze, pyinstaller... :-( ). I use python3.4 32bit.

Thanks in advance !

Discussion

  • tumagonx

    tumagonx - 2015-09-09

    Sorry, Have you tried rev22 (the switch to os.environ instead of putenv) may help packaging.

     
  • tumagonx

    tumagonx - 2015-09-09

    BTW when thing like "import error" happen during packaging, the first thing you should try is adding gnome subdirectory into PATH environment

     
  • tumagonx

    tumagonx - 2015-09-09

    Since we are talk about broad possibility of packaging it would better to put this at discussion, so other guys with different bundler may share their experience.

     
  • alfazaz

    alfazaz - 2015-09-09

    Ok. I will try your suggestions in the next minutes. About discussion on freezing, I posted a message on monday in the discussion section but it is still on moderation stage (awaiting moderation) ; see https://sourceforge.net/p/pygobjectwin32/discussion/general/thread/b8d6781c/ ;-)

     
  • alfazaz

    alfazaz - 2015-09-09

    I installed rev22. Programs work with python interpreter, but no success after freezing. It fails like on the example I put on http://bugs.nuitka.net/issue242.

    Here is my PATH :


    C:\Python34\;C:\Python34\Scripts;C:\Python34\Lib\site-packages\;C:\Python34\Lib\
    site-packages\gnome;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\
    javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syst
    em32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd


    Here are all messages :


    E:\Chemin\Test.dist>Test.exe
    Traceback (most recent call last):
    File "<frozen importlib._bootstrap="">", line 2158, in _find_spec
    AttributeError: 'DynamicImporter' object has no attribute 'find_spec'</frozen>

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "E:\Chemin\Test.dist\Test.py",
    line 1, in <module>
    File "E:\Chemin\Test.dist\gi\importer.py", line 53, in find_module
    'introspection typelib not found' % namespace)
    ImportError: cannot import name Gtk, introspection typelib not found</module>

    E:\Bla\DebugTest\Test.dist>echo %PATH%
    C:\Python34\;C:\Python34\Scripts;C:\Python34\Lib\site-packages\;C:\Python34\Lib\
    site-packages\gnome;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\
    javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Syst
    em32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd


    So now, I don't know what to try...

     
  • tumagonx

    tumagonx - 2015-09-09

    Thanks, I will try nuitka myself and maybe cx_freeze (I think lazka of Quodlibet succesfully use it)

     
  • alfazaz

    alfazaz - 2015-09-09

    Ok. If you have success with it, thanks in advance to share your solution ;-).

    (nothing to do here but sourceforge is strange for me : it marked 2 messages from me with "Post awaiting moderation" and they are still in this state... I can't even see the writings in these messages... ???? + I don't receive know notifications for new messages... Mysteries, mysteries...).

     
    • tumagonx

      tumagonx - 2015-09-09

      I could get past typelib stuff, You need to copy gnome folder's content into yourapp.dist folder
      But I get segfault... GDB show :

      Program received signal SIGSEGV, Segmentation fault.
      0x0059d9ef in CALL_FUNCTION_WITH_ARGS3 (called=0x31046e8, arg1=0x2ebac20,
          arg2=0x3143e10, arg3=0x3142670) at gtk-demo.build\__helpers.cpp:638
      638                 };
      (gdb) bt
      #0  0x0059d9ef in CALL_FUNCTION_WITH_ARGS3 (called=0x31046e8, arg1=0x2ebac20,
          arg2=0x3143e10, arg3=0x3142670) at gtk-demo.build\__helpers.cpp:638
      #1  0x004a917f in impl_function_1___init___of_class_6_GObjectMeta_of_gi$types
          (_python_par_cls=0x3145030, _python_par_name=0x2ebac20,
          _python_par_bases=0x3143e10, _python_par_dict_=0x3142670,
          self=<optimized out>) at gtk-demo.build\module.gi.types.cpp:12691
      #2  0x00405b80 in Nuitka_Method_tp_call (method=0x3104350, args=0x4, kw=0x0)
          at Lib\site-packages\nuitka\build\static_src\CompiledMethodType.cpp:253
      #3  0x73783ccb in python34!PyObject_Call ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #4  0x737c760c in python34!PyType_Ready ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #5  0x737c4994 in python34!_PyType_Fini ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #6  0x03150b70 in ?? ()
      #7  0x0059c75f in CALL_FUNCTION (function_object=0x3145030,
          positional_args=0x3150b70, named_args=<optimized out>)
          at Lib/site-packages/nuitka/build/include/nuitka/calling.hpp:51
      #8  0x0059d7f6 in CALL_FUNCTION_WITH_ARGS3 (called=0x30f1570, arg1=0x3150b70,
          arg2=0x3143e10, arg3=0x3142670) at gtk-demo.build\__helpers.cpp:851
      #9  0x0045b7b9 in impl_function_2___getattr___of_class_3_IntrospectionModule_of_
      gi$module (_python_par_self=0x2ea1530, _python_par_name=0x2ebac20,
          self=<optimized out>) at gtk-demo.build\module.gi.module.cpp:7719
      #10 0x00405b80 in Nuitka_Method_tp_call (method=0x30ecf58, args=0x2, kw=0x0)
      ---Type <return> to continue, or q <return> to quit---bt
          at Lib\site-packages\nuitka\build\static_src\CompiledMethodType.cpp:253
      #11 0x73783ccb in python34!PyObject_Call ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #12 0x7378417e in python34!PyObject_CallFunctionObjArgs ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #13 0x737c3db4 in python34!_PyType_LookupId ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #14 0x737c738e in python34!PyType_Ready ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #15 0x737b6593 in python34!PyObject_GetAttr ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #16 0x73806502 in python34!PyEval_EvalFrameEx ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #17 0x73807dfd in python34!PyEval_EvalCodeEx ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #18 0x73807f64 in python34!PyEval_EvalCode ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #19 0x738003c4 in python34!PyAST_FromNode ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #20 0x737b4812 in python34!PyCFunction_Call ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #21 0x73804a41 in python34!PyEval_GetGlobals ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #22 0x003c1e18 in ?? ()
      ---Type <return> to continue, or q <return> to quit---
      #23 0x73806e84 in python34!PyEval_EvalFrameEx ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #24 0x73807dfd in python34!PyEval_EvalCodeEx ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #25 0x73807f33 in python34!PyEval_EvalCodeEx ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #26 0x73804d8c in python34!PyEval_GetGlobals ()
         from C:\Python34\gtk-demo.dist\python34.dll
      #27 0x00000000 in ?? ()
      (gdb)
      
       
  • tumagonx

    tumagonx - 2015-09-09

    Oh if I don't use --portable it run well. hmm

     
  • tumagonx

    tumagonx - 2015-09-09

    Uugh it's hard debug...
    Well basically all you need is to copy gnome's content alongside the produced exe (assuming wtihout --portable option)

     
  • alfazaz

    alfazaz - 2015-09-09

    Gloups, it's the same for me without --portable option... But I need this option because I want to run my program on windows targets without all python stuff :-(. That's why I need to freeze my app.

     
  • tumagonx

    tumagonx - 2015-09-10

    I'm closing this as it's irrelevant to pygi or rather it's like "does niutka has specific pygi support like pyqt?" not yet.
    So it is niutka's problem not pygi. As a matter of fact run via interpreter mode is OK.

    I updated my answer here https://sourceforge.net/p/pygobjectwin32/discussion/general/thread/b8d6781c/ You might want to link that page to your niutka bugreport.

    Regarding the segfault, it because niutka's default -O3 optimization level seems make my gcc produce unstable binary, lowering it (-O2/-Os/-O1) will make it works.

     

    Last edit: tumagonx 2015-09-10
  • tumagonx

    tumagonx - 2015-09-10
    • status: open --> wont-fix
     
  • alfazaz

    alfazaz - 2015-09-10

    I linked your pages on nuitka bugreport. Thanks !!

     

Log in to post a comment.

MongoDB Logo MongoDB