Reputation: 115
Hello everyone and thank you for taking the time to help me.
I am currently trying to create a windows package for my Kivy (1.9.1) app, using PyInstaller (3.1). I followed the instructions from the documentation but couldn't get it to work. So I tried with the demo app 'touchtracer' given as example with the same results. I get the following error :
Traceback (most recent call last):
File "<string>", line 11, in <module>
File "f:\temp\pip-build-1elcla\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 48, in <module>
from pkg_resources.extern import six
File "C:\Python27\lib\site-packages\pkg_resources\extern\__init__.py", line 60, in load_module
"distribution.".format(**locals())
ImportError: The 'six' package is required; normally this is bundled
with this package so if you get this warning, consult the packager of
your distribution.
pyi_rth_pkgres returned -1
This is my .spec file:
# -*- mode: python -*-
from kivy.deps import sdl2, glew
block_cipher = None
a = Analysis(['C:\\Python27\\share\\kivy-examples\\demo\\touchtracer\\main.py'],
pathex=['C:\\Users\\PC\\Documents\\Njord\\njord\\Nouveau dossier'],
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,
a.scripts,
exclude_binaries=True,
name='touchtracer',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe, Tree('C:\\Python27\\share\\kivy-examples\\demo\\touchtracer\\'),
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
strip=False,
upx=True,
name='touchtracer')
I have tried with Kivy packages installed from pip and with the wheel's method, without success. Does anyone have an explanation?
Thanks again.
Upvotes: 4
Views: 1806
Reputation: 115
I managed to find a way to solve my problem. I tried to add the "six" package to the hidden_imports, but then it was the "packaging" package that was missing.
I then installed setuptools 19.4 through easy install and this time, even if "six" was in my hidden_imports, I got my very first error back, plus a whole lot of warnings. I looked around and a few people were saying that there was a problem with setuptools 19.4 and that it should be reverted to 19.2. I did it and then it was kivy.app that was missing, but it was progress.
I added kivy to the hidden_imports in the spec file, which led to another error saying that I had an attribute error with one of my modules. I just had to add other dependencies (sqlalchemy, sqlalchemy.orm, uuid).
Quick recap: if you have setuptools installed, make sure it's 19.2. Add external dependencies to the hidden_imports, kivy included.
Upvotes: 3
Reputation: 11
I had to add this line to work around this.
hiddenimports=['six','packaging','packaging.version','packaging.specifiers'],
Upvotes: 1