Python Forum
Creating an executable from a script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Creating an executable from a script
#1
Hi all,

I am using Python 3.6.7 32-bit on a Win-7 64bit system
I am attempting to create an executable from a script I created in eclipse 20190917-1200.
I have installed pywin32 via 'pip install pywin32', and verified I had the latest pyinstaller via 'python.exe -m pip install --upgrade pyinstaller'

I attempted creating the executable via 'pyinstaller.exe --onefile --windowed CopyExt.py', as well as 'pyinstaller.exe CopyExt.py'

Both attempts failed with:
Quote:Fatal error: PyInstaller does not include a pre-compiled bootloader for your
platform. For more details and instructions how to build the bootloader see
<https://pyinstaller.readthedocs.io/en/stable/bootloader-building.html>

In the generated output (besides the error messages), the only messages that seem to express any type of concer are:
969 INFO: UPX is not available
1467 INFO: Building because toc changed
and
1836 INFO: Bootloader c:\program files (x86)\python36-32\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
1836 INFO: checking EXE
1836 INFO: Building EXE because EXE-00.toc is non existent
1836 INFO: Building EXE from EXE-00.toc

I attempted to follow the instructions in the link mentioned in the error by:
downloading the PyInstaller 3.6 tar.gz, and fully extracting it
CDing to the bootloader folder and running 'python ./waf all' and received the following error:

Quote:could not configure a C compiler!
(complete log in C:\AXLdev\Python\gitclone3_6\PyInstaller-3.6.tar\dist\PyInstaller-3.6\PyInstaller-3.6\bootloader\build\config.log)

In doing some checking, according to this link"
https://stackoverflow.com/questions/5358...yinstaller

I shouldnt require a C install.

I am fairly new to python, and have not tried compiling a script before so Im not really sure where I stand.

does anyone have any ideas?

thanks
Reply
#2
Look at this post that i recently made.
Virtual environment is like a new python install,i use that always when troubleshooting eg with Pyinstaller.
Reply
#3
Hi SnippSat,

Thanks for the quick response!

I went through the steps outlined in your post, to create a virtual environment.
I copied the script.py file into the folder for the virtual environment, and from within the virtual command prompt I executed pyinstaller command, but wound up with the same error:

Quote:Fatal error: PyInstaller does not include a pre-compiled bootloader for your
platform. For more details and instructions how to build the bootloader see
<https://pyinstaller.readthedocs.io/en/stable/bootloader-building.html>
Reply
#4
Look at this
So you may need to do Building the Bootloader as linked in post over.

wolf8963 Wrote:I am using Python 3.6.7 32-bit on a Win-7 64bit system
Also upgrade may help look at Python 3.8 (3.6-3.7) and pip installation under Windows.
Reply
#5
Hi Snippsat,

I tried the variation for creating bootloaders in the 'this' link but no soap - 'could not configure a C compiler!'

I undertook to upgrade to 3.8 and it was a bit of a fistfight. The install went ok but running pip -V insisted on presenting 3.6, even after rebooting. I uninstalled 3.6 and then I just got errors when running pip -V. Same even after uninstalling and reinstalling 3.8.

I found the path statement on any cmd window, old or new, was still showing the 3.6 path - even after modifying the environmental variable via 'view advanced system settings'.

Ultimately I was able to get the correct path variable by modifying registry setting path value in:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

After doing that, pip -V now shows version 3.8.

However I still see the same problem of it complaining about not having a pre-compiled boot loader.

thanks
Reply
#6
I tried installing clang on one of the PCs having problems - the compile still failed - with a different error. When I checked the log indicated in the error message, it contained this error:
Quote:['C:\\Program Files\\LLVM\\bin\\clang.exe', '-Wl,--enable-auto-import', '-m32', 'test.c.1.o', '-oC:\\AXLdev\\Python\\cloneSRC\\pyinstaller\\bootloader\\build\\conf_check_9e1806166015a83897e6175b88f481fa\\testbuild\\testprog.exe', '-Wl,-Bstatic', '-Wl,-Bdynamic']
err: clang: warning: unable to find a Visual Studio installation; try running Clang from a developer command prompt [-Wmsvc-not-found]
any ideas anyone?
Reply
#7
Ok,

I have tried all of the suggestions provided, and the associated links to other threads to no avail.

I completely uninstalled all parts of python, and reinstalled python 3.8 and pyinstaller (with the non-pip install method for pyinstaller) and tried again to no avail.

In desperation I finally went ahead and installed Visual Studio and C++.
After that I was able to successfully run the 'python ./waf all --target-arch=32bit'.

I copied the run.exe into what I believed was the correct bootloader folder - by this time I had about 10 of them in various places - and tried the compile again. Once again it failed with the 'no pre-compiled bootloader error.

at this point I located a bootloader folder whose Windows-32bit folder contained the following files:
run.exe
run_d.exe
runw.exe
runw_d.exe

and began copying that folder into all bootloader folders - starting with the newest and working my way down.

Finally about the 3rd folder I copied it into worked - I was able to compile. The funny thing is they folder path that was successful included 'PyInstaller-3.6\bootloader', which is certainly a viable bootloader folder but not the one I would have suspected.

So, how can those who follow after:
Identify the correct bootloader folder in which to place the run.exe built from the ''python ./waf' run.exe file?

Is only the run.exe required or are some or all of the other 3 files I indicated required

Can python files be compiled WITHOUT having to install visual studios, Is the same true if you have to use 'python ./waf' to build the run.exe?

Once the run.exe (and possilby other 3) file is created, can it be copied to another PC with the same OS and architecture to avoid having to install VS there?

If anyone has an idea of how to get 'python ./waf' and pyinstaller to work to compile .py files without having to install VS, I still have another PC without VS I can test on.

thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to compile a Python script for a Windows / Linux executable? netanelst 2 1,273 May-24-2022, 07:02 AM
Last Post: netanelst
  Python executable Script (Wrapper) Hwang 2 1,845 Jan-12-2022, 06:53 PM
Last Post: Hwang
  No module named '_cffi_backend' error with executable not with python script stephanh 2 5,555 Nov-25-2021, 06:52 AM
Last Post: stephanh
  Help with Creating a Script for Automating Reports SunWers 1 1,882 Dec-29-2020, 10:21 PM
Last Post: jjc385
  Need help creating a simple script Nonameface 12 4,425 Jul-14-2020, 02:10 PM
Last Post: BitPythoner
  Creating an executable vman44 8 3,485 Apr-19-2020, 08:41 PM
Last Post: vman44
  Need help creating complex loop around existing script CephloRhod 5 2,705 Apr-16-2020, 01:23 PM
Last Post: deanhystad
  Best method: Python script called from another app, package as complete executable ironfelix717 2 2,091 Jul-24-2019, 07:39 AM
Last Post: DeaD_EyE
  Package python script which has different libraries as a single executable or script tej7gandhi 1 2,583 May-11-2019, 08:12 PM
Last Post: keames

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020