1
votes

This is my very first time creating an .exe (or any package at all). Although I successfully created an exe-file of the kivy-touchtracer demo, according to the kivy-manual.
I used the same approach to create an .exe from my kivy-app. It suppose to be running only on windows (first milestone).

The non-exe version runs as I wanted. I could manage to create an .exe file, but somehow it is not running.
Basically the programm should collect some data, "calculate a bit around" the given data, create some plots (matplotlib) and create a report-pdf (reportlab).

I already tried:

  • copy dateutils from python/Lib/sitepackages/dateutil into the created dist directory. (It helped by reportlab)
  • modifying the 'from .tz import *' line in dateutil/tz/init to 'from tz import *' (removing the dot)

They appeared useless...


How could I run my exe? What did I miss? (Matplotlib is in the supported-package list of pyinstaller.)

OS: Win7
Python: 3.4

My cal.spec file:

# -*- mode: python -*-

from kivy.deps import sdl2, glew

block_cipher = None


a = Analysis(['C:\\EZS-2G\\main.py'],
             pathex=['C:\\EZS-2G\\calApp'],
             binaries=None,
             datas=None,
             hiddenimports=['cycler','pyparsing','setuptools','tkinter','PyPDF2','jinja2','sqlite3','markupsafe','PIL','tornado','pytz','dateutil','reportlab','numpy','matplotlib'],
             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,
          a.scripts,
          exclude_binaries=True,
          name='Cal',
          debug=False,
          strip=False,
          upx=True,
          console=True )
coll = COLLECT(exe, Tree('C:\\EZS-2G\\'),
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               upx=True,
               name='Cal')

And here is my .kivy/log.txt as a result:

[INFO              ] Logger: Record log in C:\Users\kalibrierlabor\.kivy\logs\kivy_16-03-09_74.txt
[INFO              ] Kivy: v1.9.1
[INFO              ] Python: v3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 20:20:57) [MSC v.1600 64 bit (AMD64)]
[INFO              ] Factory: 179 symbols loaded
[INFO              ] Image: Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO              ] OSC: using <thread> for socket
[INFO              ] Window: Provider: sdl2
[INFO              ] GL: GLEW initialization succeeded
[INFO              ] GL: OpenGL version <b'3.3.0'>
[INFO              ] GL: OpenGL vendor <b'NVIDIA Corporation'>
[INFO              ] GL: OpenGL renderer <b'GeForce 210/PCIe/SSE2'>
[INFO              ] GL: OpenGL parsed version: 3, 3
[INFO              ] GL: Shading version <b'3.30 NVIDIA via Cg compiler'>
[INFO              ] GL: Texture max size <8192>
[INFO              ] GL: Texture max units <32>
[INFO              ] Window: auto add sdl2 input provider
[INFO              ] Window: virtual keyboard not allowed, single mode, not docked
[INFO              ] Text: Provider: sdl2
[WARNING           ] stderr: Traceback (most recent call last):
[WARNING           ] stderr:   File "<string>", line 58, in <module>
[WARNING           ] stderr:   File "C:\EZS-2G\CETAcalApp\dist\CETA-Cal\cls\plotting.py", line 5, in <module>
[WARNING           ] stderr:     import matplotlib.pyplot as plt
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\matplotlib\pyplot.py", line 36, in <module>
[WARNING           ] stderr:     from matplotlib.figure import Figure, figaspect
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\matplotlib\figure.py", line 40, in <module>
[WARNING           ] stderr:     from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\matplotlib\axes\__init__.py", line 4, in <module>
[WARNING           ] stderr:     from ._subplots import *
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\matplotlib\axes\_subplots.py", line 10, in <module>
[WARNING           ] stderr:     from matplotlib.axes._axes import Axes
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\matplotlib\axes\_axes.py", line 22, in <module>
[WARNING           ] stderr:     import matplotlib.dates as _  # <-registers a date unit converter
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\matplotlib\dates.py", line 130, in <module>
[WARNING           ] stderr:     import dateutil.parser
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\dateutil\parser.py", line 43, in <module>
[WARNING           ] stderr:     from . import tz
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\dateutil\tz\__init__.py", line 1, in <module>
[WARNING           ] stderr:     from .tz import *
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\dateutil\tz\tz.py", line 17, in <module>
[WARNING           ] stderr:     from .__init__ import tzname_in_python2
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
[WARNING           ] stderr:     exec(bytecode, module.__dict__)
[WARNING           ] stderr:   File "C:\Python34\lib\site-packages\dateutil\tz\__init__.py", line 1, in <module>
[WARNING           ] stderr:     from .tz import *
[WARNING           ] stderr: ImportError: No module named 'dateutil.tz.__init__.tz'
2

2 Answers

2
votes

I had the same problem (also on windows 7 and Python 3.4 and python-dateutil version 2.5). I did some reading e.g. at https://github.com/dateutil/dateutil/pull/202#issuecomment-192352290. Like you I tried to make some amendments to the dateutil package, but in the end I simply reverted the package to the previous version with pip i.e. 'pip install python-dateutil==2.4.2' and that resolved the issue for me.

0
votes

I had similar problem. Since everything worked I found a workaround using:

import warnings

warnings.filterwarnings("ignore", category=UserWarning)