Hello list,

I've been playing around with cx_Freeze for some days.  Through two projects that I ran it appears to me cx_Freeze didn't do too well when trying to build from a virtual environment.  I was puzzled as to why, so I tried harder to get more helpful information before sending this email.


Few things seem to be part of the same issue: first of all, not all the standard library is frozen by cx_Freeze, which is probably normal (it only freezes what it needs, I guess... though again I wouldn't be sorry to get rid of Tkinter which isn't that light). Some .pyc modules end up in the library.zip file.  Some end up in the lib folder, right along the executable(s).  Honestly, I'm not sure why this distinction, but it seems cx_Freeze doesn't particularly appreciate us editing the library.zip file.  So be it!  I played with the files in the lib folder.


The library I was trying to freeze kept trying to "import distutils" for some reason, and this kept failing.  The error message was absolutely unhelpful (since I obtained it through a Django webpage in some bizarre circumstances and didn't have access to a full traceback despite heavy debugging).  What was wrong with distutils?  The problem in my case is that distutils itself is quite light in my virtual environment.  If you open your venv\lib\distutils, you might find only two files.  One of them will specify using the complete library in the Python path. Horror!  How to freeze that?  I guess this has to be, for distutils should keep track of whether we're running a virtual environment or not... but this absolutely didn't help cx_Freeze.


So I cheated: I opened the main Python library (C:\python27\Lib\distutils for me), copied the .pyc files in them and pasted them into the build folder generated by cx_Freeze (...\build\exe-...\lib\distutils).  This worked, after a few tricks, but it's probably not the right way to handle that situation.  So I was wondering:


1. Could someone explain to me why distutils behave in such a way that it would break freezing it if cx_Freeze is run from a virtual environment?

2. What would be the best strategy to handle that situation?


(Please, don't say: run in main Python.  This is not an option for me.  This library changes some settings and have a lot of dependencies I have to keep in a separate virtual environment.)


Thank you in advance,


Vincent



_______________________________________________
cx-freeze-users mailing list
cx-freeze-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cx-freeze-users

Reply via email to