New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EXE exits without error shown but works from command line #682
Comments
cx_Freeze: Python error in main scriptTraceback (most recent call last): This is the exact error I get with |
Try to add the "scipy.ndimage.filters" to packages option or "scipy.ndimage._ni_support" to includes option. |
The
I am looking to slim it down rather than using I did have an input function in my code, which I greyed out with no change for the better. The Here is my set-up script to help guide where I may have taken a wrong turn:
Not having an |
cx_Freeze 6.2 has just been released with namespace detection. Please, try it. |
I am not able to get any similar response with the new installation. It seems to have sent me back further: cx_Freeze: Python error in main script (traceback unavailable)Cannot import traceback module.
|
If you don't use a tkinter or wx or another framework, you don't need to add Win32GUI. On windows, you can run the console app too. This new error is strange. Can you remove and reinstall cx-freeze package and use the workarounds? |
I have found the error may be related to my program, and I am having to go through object by object to see where the error lies. I have had progress with opening the program, but now that I've incorporated the GUI with tkinter, new problems are arising. I believe that reinstalling my anaconda and cx_freeze environments solved some concerns, but I am running aground with getting the output to show in the GUI, to show that it is indeed working. This will show where it breaks, so more to come once I unlock the tkinter framework. |
I have been able to get my program to run using the console, but not the app. S'funny to wind up back here, but I have made some progress with the update, and by getting rid of the eviron variables, and matching closely to what I put up earlier for my set-up. |
If you have a C compiler, you can test the development version: |
I have run this install, and now I get a new error:
|
PR #727 solve this. Can you test again? |
OK, that hurdle is now passed--no longer get the abiflags error--thanks! I am at the same point from a week ago. Perhaps I am not doing the C-compiler test properly. Can you walk me through this post-running the install? I ran the install, which worked. Do I now build from that and not the console? |
With the development version of cx-freeze, workarounds aren't necessary. |
Thank you for getting back to me so fast! OK, makes sense as a way to bypass having to make the plugins on the respective files. I suppose I need to run this each time to ensure I have the latest updates, yes? I was able to get matplotlib examples to run, but had to add my own DLLs, same as before, so I'm still not clear on the benefit. I did get through the workarounds, however. However, back to the original problem, the matplotlib files do not run from the exe, but rather from console only. Fortunately, I can get them to run from there, so's I know I'm not losing it. |
Until I release a new version, if you can test the latest updates, you should run the command: Show me your updated setup.py |
|
Just following back up. Is this how you imagined the setup file would look? |
Hi Marcelo (@marcelotduarte) and @double0darbo, I've read your correspondence on the cx_Freeze issues with Python packages. Thanks for sharing your experience. I'm having trouble with using cx_Freeze to create a console executable from Python code that uses scipy. I tried numerous solutions, which are listed above, but none of them worked. I'm using cx_Freeze 6.2 (latest from your development branch), scipy 1.5.0, Python 3.7.7, Conda 4.8.2, running on x64 Windows 10. Below is a minimalistic Python script that uses scipy, and a setup.py file: test.py:
setup.py:
For the above example, an executable is created. When been bun in Conda shell with the proper environment is activated, it runs fine. However, I need to be able to execute it in the ordinary Windows command line, which I cannot do as it dies on the import line, never reaching the line that prints scipy version. Any help with this issue will be mostly appreciated. Thank you in advance. Regards, |
Is this the exact copy? The line: If it helps, here's what I got for an error on my system:
I haven't dig into this any further. Thanks for the idea to try it though. Here's my script:
|
Hi @double0darbo, Thank you very much for your help! I used your version of setup.py, and it worked. I was able to run my test file. The version that worked for me is as follows:
Many thanks again, and best wishes. Regards, |
@double0darbo |
Please see comment here: #739 (comment). Plenty more debugging to come, but I am making progress after many errors. |
Same issue here, with cx_Freeze 6.5.3, numpy 1.20.1, mkl 2020.4 (installed via conda) on Windows 10 1909. python_path = os.path.split(sys.executable)[0]
mkl_omp_files_relative_path = os.path.join("Library", "bin")
mkl_omp_files = glob.glob(os.path.join(python_path, mkl_omp_files_relative_path, "libiomp*.dll"))
mkl_files = glob.glob(os.path.join(python_path, mkl_omp_files_relative_path, "mkl_*.dll"))
setup(
....
options={
"build_exe": {
"includes": ["pandas", "PySimpleGUI", ],
"excludes": ["pytest", "unittest"],
"include_files": mkl_files + mkl_omp_files,
},
}
) The resulting MSI installer is 280 MB big. Two weeks ago i had a build (in a different environment for which I don't have the specs anymore) were it worked without inluding mkl files and the resulting installer was only 50 MB big. Fixing to numpy<1.18.3 does not work for me. |
I had the same issue very recently. The program (the executable) would run fine in PyCharm and in the anaconda prompt, but would crash without errors when run from the command line or by clicking the excutable in Explorer. I tried running the python script in the command prompt via C:<INTERPRETER_PATH>\python.exe C:<PATH_TO_SCRIPT>script.py, and would get the following error (see long traceback below). Apparently this was casued by some issue when installing numpy via conda. Removing numpy from the environment and insalling it with pip solved the problem immediately. It worked both when run from the command line as a python script AND as an executable. Perhaps this might help others as well. NB: I made sure to explicitly include the mkl_thread.dll in my "include_files".
|
@adouverny @mbunse @double0darbo I used numpy 1.18.2, 1.19.4 and 1.20.1 to test, in py36, 37, 38, 39 on Windows 10 Please test it and put a comment.
|
Hi @marcelotduarte,
My setup.py looks like above, I just commented out the This is my conda environment:
|
@mbunse For conda, I put the hooks is in develop branch: It builds simple samples that use numpy. I used miniconda3 with py3.8.8 to test. Do you need wheels to test? |
@marcelotduarte Thank you very much again! The app starts without any problem from within a conda shell, now! Great work! But without conda in my path I just get a generic popup window "app.exe has stopped working". Here you can find a minimal example reproducing the problem: https://github.com/mbunse/cxfreeze_test |
@mbunse I updated the branch, please rerun: Also, with recent changes, you should use --includes-msvcr=true or include it in build_exe option of the setup file if you need vcruntimes in the build. Your sample now build for me. |
The app now works as expected after installation. |
@marcelotduarte I have tried to use the newest branch in a clean test environemnt, and it works like a charm (I made sure to install numpy via pip this time). Thank you very much for your work! |
Finally, installing numpy from pip (together with the most recent cx_freezer repo) did also the trick for me. 👍 |
cx_Freeze 6.6 has just been released. |
I am through the looking glass here.
I am running cx_freeze on the following system:
I've included the main modules used for this program.
First build had initial problem discussed in #355 and #199 , including the proper DLLs.
I corrected by copying
libiomp5md.dll
,mkl_intel_thread.dll
, andmkl_sequential.dll
into the build folder.Next, I get a scipy error, similar to past issues, #43 , #233 , and others, regarding the scipy modules.
I solved this, not by specifying scipy in the
includes
exe setup options, but rather in the"include_files"
option as(scipy_path, "scipy")
, where scipy_path is the location of thesite-packages\scipy
folder for the specific envs path (conda environment) I am building the .exe in. I am not certain why I can't specify the particular modules used inincludes
, as I have done this formatplotlib.pyplot
.My program will execute now as expected, but only from the conda powershell/command line. When attempting to click on the .exe file, nothing happens.
Attempting a solution, I placed the
base="Win32GUI"
in the Executable, as per here, but to no avail. Thoughts?The text was updated successfully, but these errors were encountered: