Unable to create .exe with 'import gooey' and 'import openpyxl' in my py script.

79 views
Skip to first unread message

Kip Garvey

unread,
Jan 8, 2024, 1:23:10 AMJan 8
to PyInstaller
My py script runs as expected when launched using python. Creating a .exe using pyinstaller does not work. Both modules are not imported, though they run fine in the script otherwise on the same Windows system. I've researched daily for a week now, no luck.

My script: 4gg-csv2xcl.py
#!python3
# -*- coding: utf-8 -*-

from gooey import Gooey, GooeyParser
from message import display_message
import os, sys, pathlib
from openpyxl import load_workbook

@Gooey(dump_build_config=True,
       program_name="The Totally Awesome...COSMGC Foursomes Count Importer",
       default_size=(600,400))
def parse_args():
    prog_descrip = 'Moving csv data to an Excel workbook. The mighty Kipster!'
    parser = GooeyParser(description=prog_descrip)
    # parser = GooeyParser()
    parser.add_argument('csv_source_file',
                        metavar='Name/location of csv file:',
                        action='store',
                        widget='FileChooser',
                        help="csv file with the data to import into Excel")
    parser.add_argument('xcl_output_file',
                        metavar='Name/location of target Excel file:',
                        action='store',
                        widget='FileChooser',
                        help="excel file to receive csv data",
                        default=r"\\DS218Plus\home\Drive\General\2024 GG Foursomes Count.xlsx")  
    args = parser.parse_args()
    return args
def main():
    args = parse_args()
    csv_name  = args.csv_source_file
    excel_name = args.xcl_output_file
    # dnldpath = r'c:\users\kip\Downloads'
    # excel_name = r'\\DS218Plus\home\Drive\General\2024 GG Foursomes Count.xlsx'
    print()
    print("You must select a csv file that contains the data you want to copy. You selected "+csv_name+".")
    print()
    print("This program writes the data from the comma-separated value file (such as: .csv, .txt or .data) to the Excel file you selected, " + excel_name)
    print()
    sep = ","
    excelFile = excel_name
     
    try:
        wb = load_workbook(filename=excel_name)
        wb.save(excel_name)
    except Exception as e:
        print("...............E R R O R ................." + str(e))
        print()
        print("The selected Excel file is missing or open. If it is open, please close: " + excelFile + " then click 'Restart' to continue.")
        sys.exit()
    try:
        if 'temp' in wb.sheetnames:
            wb.move_sheet("temp", -(len(wb.sheetnames)-1))
        else:
            wb.create_sheet('temp',0)
        sheet = wb.worksheets[0]
        file = open(csv_name,"r",encoding = "utf-8")
    except Exception as e:
        print("...............E R R O R ................." + str(e))
        print()
        # print(sheet)
        isFile=os.path.isfile(csv_name)
        if (isFile != csv_name):
            print("CSV File " + csv_name + " Not Found")
        sys.exit()
    #rows and columns
    # row data will append from last row
        # if data exists, go to next row
    if sheet.max_row > 1:
            row=sheet.max_row + 1
    else :
            # if no data on sheet, start from row 1
            row=sheet.max_row
    print("Starting at row, " + str(row))
    column = 1
    #for each line in the csv file
    for line in file:
            #remove the \n from the line and make it a list with the separator
        line = line[:-1]
        line = line.split(sep)
            #for each data in the line
        for data in line:
            sheet.cell(row,column).value = data
            column += 1
        # to write the next row column number is set to 1 and row number is increased by 1
        column = 1
        row += 1
    print("Ending on row " + (str((row-1))))
    #saving the excel file and closing the csv file
    wb.save(excel_name)
    file.close()
    sys.stdout.flush
   
def here_is_more():
    pass
if __name__ == '__main__':
    main()

My tries with pyinstaller:
C:\>cd users\kip\downloads\csv2xcl

C:\Users\kip\Downloads\csv2xcl>pyinstaller -F build.spec
450 INFO: PyInstaller: 6.3.0
451 INFO: Python: 3.12.1
530 INFO: Platform: Windows-11-10.0.22000-SP0
option(s) not allowed:
  --onedir/--onefile
makespec options not valid when a .spec file is given

OK, SO NOW TRY WITHOUT USING THE -F OPTION:
C:\Users\kip\Downloads\csv2xcl>pyinstaller build.spec
...BLAH BLAH BLAH
"C:\Users\kip\AppData\Roaming\Python\Python312\site-packages\PyInstaller\building\build_main.py", line 1011, in build
    exec(code, spec_namespace)
  File "build.spec", line 3, in <module>
    import gooey
ModuleNotFoundError: No module named 'gooey'

OK, TRY WITH DEBUG
C:\Users\kip\Downloads\csv2xcl>pyinstaller --debug=imports 4gg-csv2xcl.py
....BLAH, BLAH, BLAH...
WARNING: The output directory "C:\Users\kip\Downloads\csv2xcl\dist\4gg-csv2xcl" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
On your own risk, you can use the option `--noconfirm` to get rid of this question.
13242 INFO: Removing dir C:\Users\kip\Downloads\csv2xcl\dist\4gg-csv2xcl
13252 INFO: Building COLLECT COLLECT-00.toc
13333 INFO: Building COLLECT COLLECT-00.toc completed successfully.

OK, THIS SEEMED TO WORK, BUT .EXE WILL NOT RUN. COMMAND WINDOW OPENS AND CLOSES IMMEDIATELY
SO, LET'S TRY

C:\Users\kip\Downloads\csv2xcl>pyinstaller --hiddenimport gooey 4gg-csv2xcl.py
...BLAH, BLAH, INTERESTING IT COMPILES EVEN THOUGH THE '--hiddenimport' should be '--hidden-import', just another unexplained frustration...compile is successful
...8586 INFO: checking COLLECT
8586 INFO: Building COLLECT because COLLECT-00.toc is non existent
8587 INFO: Building COLLECT COLLECT-00.toc
8678 INFO: Building COLLECT COLLECT-00.toc completed successfully.

OK, BUT .EXE FAILS TO RUN. SO TRY...

C:\Users\kip\Downloads\csv2xcl>pip install gooey --target C:\Users\kip\AppData\Roaming\Python\Python312\site-packages
Access is denied.

OK. MY BAD. SO TRY...

C:\Users\kip\Downloads\csv2xcl>pip install gooey --target C:\Users\kip\AppData\Roaming\Python\Python312\site-packages
ERROR: Can not combine '--user' and '--target'

C:\Users\kip\Downloads\csv2xcl>pip install gooey --target Python\Python312\site-packages
ERROR: Can not combine '--user' and '--target'

OK. ANOTHER RABBIT HOLE. SO NOW TRY....add path to modules directly to 'hiddenimports' in build.spec file...

C:\Users\kip\Downloads\csv2xcl>pyinstaller build.spec
...BLAH, BLAH, BLAH
..."C:\Users\kip\AppData\Roaming\Python\Python312\site-packages\PyInstaller\building\build_main.py", line 1011, in build
    exec(code, spec_namespace)
  File "build.spec", line 3, in <module>
    import gooey
ModuleNotFoundError: No module named 'gooey'

OK. FORGET LOOKING FOR GOOEY AND TRY DEBUG ON ORIGINAL SCRIPT WHILE BUILDING .EXE...

C:\Users\kip\Downloads\csv2xcl>pyinstaller --debug=all 4gg-csv2xcl.py
490 INFO: PyInstaller: 6.3.0
491 INFO: Python: 3.12.1
626 INFO: Platform: Windows-11-10.0.22000-SP0
630 INFO: wrote C:\Users\kip\Downloads\csv2xcl\4gg-csv2xcl.spec
638 INFO: Extending PYTHONPATH with paths
['C:\\Users\\kip\\Downloads\\csv2xcl']
1133 INFO: checking Analysis
1137 INFO: Building because hiddenimports changed
1137 INFO: Initializing module dependency graph...
1140 INFO: Caching module graph hooks...
1161 INFO: Analyzing base_library.zip ...
3541 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\kip\\AppData\\Roaming\\Python\\Python312\\site-packages\\PyInstaller\\hooks'...
3639 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\kip\\AppData\\Roaming\\Python\\Python312\\site-packages\\PyInstaller\\hooks'...
5954 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\kip\\AppData\\Roaming\\Python\\Python312\\site-packages\\PyInstaller\\hooks'...
7509 INFO: Caching module dependency graph...
7663 INFO: Running Analysis Analysis-00.toc
7663 INFO: Looking for Python shared library...
7686 INFO: Using Python shared library: C:\Users\kip\AppData\Local\Programs\Python\Python312\python312.dll
7687 INFO: Analyzing C:\Users\kip\Downloads\csv2xcl\4gg-csv2xcl.py
7702 INFO: Processing module hooks...
7711 INFO: Performing binary vs. data reclassification (2 entries)
7714 INFO: Looking for ctypes DLLs
7720 INFO: Analyzing run-time hooks ...
7722 INFO: Including run-time hook 'C:\\Users\\kip\\AppData\\Roaming\\Python\\Python312\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
8282 INFO: Looking for dynamic libraries
8484 INFO: Extra DLL search directories (AddDllDirectory): []
8484 INFO: Extra DLL search directories (PATH): []
8688 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8688 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8691 WARNING: Library not found: could not resolve 'api-ms-win-crt-filesystem-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8692 WARNING: Library not found: could not resolve 'api-ms-win-crt-time-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8693 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8694 WARNING: Library not found: could not resolve 'api-ms-win-crt-conio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8694 WARNING: Library not found: could not resolve 'api-ms-win-crt-math-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8695 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8696 WARNING: Library not found: could not resolve 'api-ms-win-crt-environment-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8697 WARNING: Library not found: could not resolve 'api-ms-win-crt-locale-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8698 WARNING: Library not found: could not resolve 'api-ms-win-core-path-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8699 WARNING: Library not found: could not resolve 'api-ms-win-crt-process-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8699 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\python312.dll'.
8700 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8701 WARNING: Library not found: could not resolve 'api-ms-win-crt-math-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8702 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8703 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8703 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8704 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8706 WARNING: Library not found: could not resolve 'api-ms-win-crt-locale-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_decimal.pyd'.
8709 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_hashlib.pyd'.
8711 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_hashlib.pyd'.
8712 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_lzma.pyd'.
8713 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_lzma.pyd'.
8714 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd'.
8715 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd'.
8716 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_bz2.pyd'.
8717 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd'.
8718 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd'.
8720 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\unicodedata.pyd'.
8720 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\select.pyd'.
8722 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd'.
8725 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd'.
8726 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\_socket.pyd'.
8727 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8729 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8730 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8731 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8732 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\VCRUNTIME140.dll'.
8733 WARNING: Library not found: could not resolve 'api-ms-win-crt-runtime-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8735 WARNING: Library not found: could not resolve 'api-ms-win-crt-time-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8737 WARNING: Library not found: could not resolve 'api-ms-win-crt-stdio-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8740 WARNING: Library not found: could not resolve 'api-ms-win-crt-heap-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8740 WARNING: Library not found: could not resolve 'api-ms-win-crt-convert-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8741 WARNING: Library not found: could not resolve 'api-ms-win-crt-environment-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8742 WARNING: Library not found: could not resolve 'api-ms-win-crt-filesystem-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8743 WARNING: Library not found: could not resolve 'api-ms-win-crt-string-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8743 WARNING: Library not found: could not resolve 'api-ms-win-crt-utility-l1-1-0.dll', dependency of 'C:\\Users\\kip\\AppData\\Local\\Programs\\Python\\Python312\\DLLs\\libcrypto-3.dll'.
8766 INFO: Warnings written to C:\Users\kip\Downloads\csv2xcl\build\4gg-csv2xcl\warn-4gg-csv2xcl.txt
8787 INFO: Graph cross-reference written to C:\Users\kip\Downloads\csv2xcl\build\4gg-csv2xcl\xref-4gg-csv2xcl.html
8799 INFO: checking PYZ
8800 INFO: Building because toc changed
8801 INFO: Building PYZ (ZlibArchive) C:\Users\kip\Downloads\csv2xcl\build\4gg-csv2xcl\PYZ-00.pyz
8979 INFO: Building PYZ (ZlibArchive) C:\Users\kip\Downloads\csv2xcl\build\4gg-csv2xcl\PYZ-00.pyz completed successfully.
8999 INFO: checking PKG
9000 INFO: Building because toc changed
9000 INFO: Building PKG (CArchive) 4gg-csv2xcl.pkg
9015 INFO: Building PKG (CArchive) 4gg-csv2xcl.pkg completed successfully.
9020 INFO: Bootloader C:\Users\kip\AppData\Roaming\Python\Python312\site-packages\PyInstaller\bootloader\Windows-64bit-intel\run_d.exe
9020 INFO: checking EXE
9021 INFO: Building because debug changed
9022 INFO: Building EXE from EXE-00.toc
9025 INFO: Copying bootloader EXE to C:\Users\kip\Downloads\csv2xcl\build\4gg-csv2xcl\4gg-csv2xcl.exe
9037 INFO: Copying icon to EXE
9044 INFO: Copying 0 resources to EXE
9044 INFO: Embedding manifest in EXE
9051 INFO: Appending PKG archive to EXE
9054 INFO: Fixing EXE headers
9132 INFO: Building EXE from EXE-00.toc completed successfully.
9139 INFO: checking COLLECT
WARNING: The output directory "C:\Users\kip\Downloads\csv2xcl\dist\4gg-csv2xcl" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
On your own risk, you can use the option `--noconfirm` to get rid of this question.
16660 INFO: Removing dir C:\Users\kip\Downloads\csv2xcl\dist\4gg-csv2xcl
16669 INFO: Building COLLECT COLLECT-00.toc
17244 INFO: Building COLLECT COLLECT-00.toc completed successfully.

...OK. LOOKS GOOD. TRY RUNNING .EXE. NO LUCK. TRY FORCING HIDDEN IMPORT USING BUILD.SPEC

C:\Users\kip\Downloads\csv2xcl>pyinstaller --hidden-import gooey build.spec
693 INFO: PyInstaller: 6.3.0
694 INFO: Python: 3.12.1
850 INFO: Platform: Windows-11-10.0.22000-SP0
option(s) not allowed:
  --hidden-import/--hiddenimport
makespec options not valid when a .spec file is given

...OK. DIDN'T KNOW THAT. TRY AGAIN SPECIFYING TARGET PY SCRIPT

C:\Users\kip\Downloads\csv2xcl>pyinstaller --hidden-import gooey 4gg-csv2xcl.py
611 INFO: PyInstaller: 6.3.0
611 INFO: Python: 3.12.1
822 INFO: Platform: Windows-11-10.0.22000-SP0
827 INFO: wrote C:\Users\kip\Downloads\csv2xcl\4gg-csv2xcl.spec
835 INFO: Extending PYTHONPATH with paths
['C:\\Users\\kip\\Downloads\\csv2xcl']
1778 INFO: checking Analysis
1802 INFO: checking PYZ
1841 INFO: checking PKG
1847 INFO: Bootloader C:\Users\kip\AppData\Roaming\Python\Python312\site-packages\PyInstaller\bootloader\Windows-64bit-intel\run.exe
1847 INFO: checking EXE
1850 INFO: checking COLLECT
WARNING: The output directory "C:\Users\kip\Downloads\csv2xcl\dist\4gg-csv2xcl" and ALL ITS CONTENTS will be REMOVED! Continue? (y/N)y
On your own risk, you can use the option `--noconfirm` to get rid of this question.
9685 INFO: Removing dir C:\Users\kip\Downloads\csv2xcl\dist\4gg-csv2xcl
9697 INFO: Building COLLECT COLLECT-00.toc
9784 INFO: Building COLLECT COLLECT-00.toc completed successfully.

...OK, LOOKS GOOD. BUT, .EXE DOES NOT RUN.

C:\Users\kip\Downloads\csv2xcl>

Kip Garvey

unread,
Jan 8, 2024, 5:03:58 PMJan 8
to PyInstaller
Tony C's post highlights a situation that may be affecting my .exe build. I think my .py script runs ok in the Python 3.11 environment because that's where the two modules (openpyxl and gooey) reside in a sites-packages folder. However, when I run pyinstaller, I see that the Python interpreter is 3.12.1 and not the 3.11 I expected. This could be causing my issue. The entire 3.11 package is installed in my AppData\Local\... path, whereas my Python 3.12 package is installed under the AppData\Roaming\Python path, and in this path, there is a sites-packages folder that does NOT contain the gooey or openpyxl packages.  Can anyone explain how I can get these two packages installed in the Python 3.12 path? I have tried to force this path into the pyinstaller script a couple of different ways. First, I included the path in the hiddenimports value pair in my build.spec file with no success. Then I tried various combinations using the --hidden-import switch on the command line with no success.

Chris Barker

unread,
Jan 8, 2024, 11:28:34 PMJan 8
to pyins...@googlegroups.com
you've fallen into a all too common trap -- more than one Pythn installed in your system.

decide which one you what to use, and ideall uninstall the other so you don't have this issue again :-) -- otherwise:

figure out how to run:
python
and 
pip

so that they are using the same Python.

then install PYINstllerin into the Python you want.

make sure your app runs with that Python.

Run PyInstaller again.

In short: make sure EVERYTHING you are doing is with the same Python install.

-HTH,
-CHB

C:\Users\kip\Downloads\csv2xcl>pyinstaller -F build.spec
450 INFO: PyInstaller: 6.3.0
451 INFO: Python: 3.12.1

There's your hint -- PyInstaller is using 3.12

-CHB

 
--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris....@noaa.gov
Reply all
Reply to author
Forward
0 new messages