0

I use pyinstaller to create onefile exe. It works on few computers but one. I can't work out why. There is no error when I run this from command window. I can see a window for point of a second and it dissapear. Below is my spec file. There is no antivirus installed. Also windows firewall is shut down.

SPEC

from kivy.deps import sdl2, glew
block_cipher = None
a = Analysis(['main.py'],
             pathex=['C:\\Users\\Patryk\\GUI\\EXE'],
             binaries=None,
             datas=None,
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,Tree('C:\\Users\\PycharmProjects\\GUI\\EXE'),
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
          name='Bajot2',
          debug=False,
          strip=False,
          upx=True,
          console=False, 
          runtime_tmpdir=None,
          icon='main_logo.ico' )

I've managed to see the error. That's makes me closer to solve it.

ERROR

[INFO   ] [Logger      ] Record log in C:\Users\Dell\.kivy\logs\kivy_19-07-02_7.
txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1
900 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil
, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.2.0 - Build 10.18.10.3262'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 4600'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 2
[INFO   ] [GL          ] Shading version <b'4.20 - Build 10.18.10.3262'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <16>
[WARNING] [Image       ] Unable to load image <C:\Users\Dell\AppData\Local\Temp\
_MEI40162\kivy_install\data\glsl\default.png>
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - Exception: SDL2: Unable to load image
  File "site-packages\kivy\core\__init__.py", line 67, in core_select_lib
  File "site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
  File "site-packages\kivy\core\window\__init__.py", line 968, in __init__
  File "site-packages\kivy\core\window\window_sdl2.py", line 294, in create_wind
ow
  File "site-packages\kivy\core\window\__init__.py", line 1216, in create_window


  File "kivy\graphics\instructions.pyx", line 759, in kivy.graphics.instructions
.RenderContext.__init__
  File "site-packages\kivy\core\image\__init__.py", line 536, in __init__
  File "site-packages\kivy\core\image\__init__.py", line 732, in _set_filename
  File "site-packages\kivy\core\image\__init__.py", line 435, in load
  File "site-packages\kivy\core\image\__init__.py", line 201, in __init__
  File "site-packages\kivy\core\image\img_sdl2.py", line 41, in load
[CRITICAL] [App         ] Unable to get a Window, abort

.

9
  • How do you call the PyInstaller? Try to call it through a batch file and the last command should be PAUSE. Then the command window stay open. Commented Jul 2, 2019 at 11:42
  • I use pyinstaller main.spec command to create the file.
    – ForyszeP
    Commented Jul 2, 2019 at 13:14
  • set console=True and run the exe in cmd and put the full log error in here. Commented Jul 2, 2019 at 14:17
  • After setting console to True I can see an error.[CRITICAL] [Window ] Unable to find any valuable Window provider. sdl2 - Exception: SDL2: Unable to load image. I've no idea why this error is trown only on one computer.
    – ForyszeP
    Commented Jul 2, 2019 at 14:34
  • Does the resulting program need additional files and are they in the correct place? How do you load the image inside your Python Script? Do you use relative or absolute paths? Commented Jul 3, 2019 at 6:35

4 Answers 4

1

Launch the executable from the command line, open a cmd window and navigate to your exe, then just type the name of the exe.

What's happening is that it's throwing an error and immediately shutting down before you can read it, If you launch from the command line the command window will stay open and you'll be able to read the error

0
0

It is probably due to different version and packages installed. Try creating and environment with Python 3.6, install Pyinstaller in it and it should work.

0

I always highly recommend to use a windows batch file for configuring and using pyinstaller. This is basically a text file with the extension ".bat" or ".cmd". You can simply edit it and call it via double-click.

WINDOWS BATCH-FILE

@echo off

:: Do what you like...

pyinstaller --clean ^
--one-file ^
--name BLABLA_PROG ^
main.spec

PAUSE

COMMENT

The last command is now important for debugging, because the command window will remain open.

1
  • I've just try your method. The exe was created succesfully but still the same issue. It works on my computer but it doesn't on my colleague one. It still doesn't throw any error when I run from cmd.
    – ForyszeP
    Commented Jul 2, 2019 at 14:03
0

After reinstalling intel graphic card driver .exe starts without any problems.

Not the answer you're looking for? Browse other questions tagged or ask your own question.