2

I have a small python script where I have only one dependency

from pandas import DataFrame as pdf

I want to create a .exe that would only require users to have python installed in their PATH. This guide helped me run the creation but the yielding dist folder is empty. Does anyone know why this is the case or

what I am doing wrong?

Specs: written in and for Windows OS, Python 3.6.5 - Anaconda

Edit: Here's the sample I am working with.

from pandas import DataFrame as pdf
if "__main__":
    df = pdf([['This', 'is'], ['a', 'Test']],
                     index=['Row 1', 'Row 2'],
                     columns=['col 1', 'col 2'])
    df.to_excel("output\output.xlsx")

The resulting spec file is

# -*- mode: python -*-

block_cipher = None


a = Analysis(['src\\sample.py'],
             pathex=['C:\\Users\\kpiq\\Documents\\Data Science\\Executable Creation'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='sample',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name='sample')

The command used was pyinstaller src\sample.py

Tamara Koliada
  • 1,200
  • 2
  • 14
  • 31
Kevin
  • 43
  • 2
  • 6
  • Do you get any error messages? – John Anderson Feb 20 '19 at 16:22
  • No everything runs successfully. – Kevin Feb 20 '19 at 16:38
  • Then you will need to post your python script, the `.spec` file that `Pyinstaller` creates, and the command that you run to create an `.exe` file. – John Anderson Feb 20 '19 at 17:42
  • See edits above. – Kevin Feb 20 '19 at 18:14
  • Are you sure the `dist` directory is completely empty? `Pyinstaller` should create a `sample` directory inside the `dist` directory. And the `.exe` should be in that directory. By the way, if your `Pyinstaller` is successful, then even `Python` is not required to be installed in order to run the resulting `.exe`. – John Anderson Feb 20 '19 at 20:18

4 Answers4

1

Because I had Avast anti-virus installed on my computer it detected my new executable as a malware and it deleted it immediately after compilation and I had to disable for a while like until next restart and then I tested my new app.

You can also try running pyinstaller yourapp.spec in your app directory.

samnodier
  • 355
  • 3
  • 2
0

I found an answer posted by NAP_time in another question 1. The solution was to download the trial version using:

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

I did this and it worked for me. Best of luck.

rob
  • 1
0

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

i have the same problem earlier but after trying this i was able

0

I just had this same issue. For me, my anti-virus flagged the newly created .exe as potential malware and removed it. Once I launched my AV and instructed it to consider the file safe, it showed back up in the dist folder and worked fine.

Karl
  • 1