-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Desktop packaging] Compiled application error. Unable to import kivy._clock #14
Comments
Use pyinstaller.
Le ven. 17 juil. 2020 à 06:19, FrancoTonutti <[email protected]> a
écrit :
… I use this lib in the following project
https://github.com/FrancoTonutti/Calculo-UTN-FRP <http://url>
After trying to compile with python setup.py bdist_apps, the generated
.exe doesn't work
I think the error is due to the following, but I don't know how to compile
panda3d and kivy at the same time
[ERROR ] [Clock ] Unable to import kivy._clock. Have you perhaps forgotten
to compile kivy? Kivy contains Cython code which needs to be compiled. A
missing kivy._clock often indicates the Cython code has not been compiled.
Please follow the installation instructions and make sure to compile Kivy
output.log:
[ERROR ] [Core ] error while reading localconfiguration
Traceback (most recent call last):
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\config.py", line 703, in <module>
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\config.py", line 469, in read
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 857, in items
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 857, in <listcomp>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 854, in <lambda>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 394, in before_get
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 444, in _interpolate_some
ConfigParser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%y-%m-%d_%_.txt'
[ERROR ] Error while activating FileHandler logger
Traceback (most recent call last):
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\logger.py", line 234, in emit
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\logger.py", line 165, in _configure
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\config.py", line 501, in get
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 799, in get
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 394, in before_get
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 444, in _interpolate_some
ConfigParser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%y-%m-%d_%_.txt'
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\win32\CalculoUTN.exe"
[INFO ] [Python ] v3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 09:44:33) [MSC v.1900 32 bit (Intel)]
[INFO ] [Python ] Interpreter at "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\win32\CalculoUTN.exe"
[ERROR ] [Clock ] Unable to import kivy._clock. Have you perhaps forgotten to compile kivy? Kivy contains Cython code which needs to be compiled. A missing kivy._clock often indicates the Cython code has not been compiled. Please follow the installation instructions and make sure to compile Kivy
Traceback (most recent call last):
File "main.py", line 5, in <module>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 967, in _find_and_load_unlocked
module = _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 819, in exec_module
exec(code, module.__dict__)
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\app\user_interface\main_ui.py", line 1, in <module>
from panda3d_kivy.app import App
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 967, in _find_and_load_unlocked
module = _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 819, in exec_module
exec(code, module.__dict__)
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\panda3d_kivy-0.1.2-py3-none-any.whl\panda3d_kivy\app.py", line 2, in <module>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 967, in _find_and_load_unlocked
module = _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 819, in exec_module
exec(code, module.__dict__)
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\panda3d_kivy-0.1.2-py3-none-any.whl\panda3d_kivy\core\window.py", line 5, in <module>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 967, in _find_and_load_unlocked
module = _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 819, in exec_module
exec(code, module.__dict__)
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\app.py", line 319, in <module>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 967, in _find_and_load_unlocked
module = _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 819, in exec_module
exec(code, module.__dict__)
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\base.py", line 26, in <module>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 967, in _find_and_load_unlocked
module = _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 819, in exec_module
exec(code, module.__dict__)
File "D:\Bibliotecas\Documentos\Python 3\UTN\Calculo-UTN-FRP-master\build\__whl_cache__\win32_cp37m\Kivy-1.11.1-cp37-cp37m-win32.whl\kivy\clock.py", line 363, in <module>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 967, in _find_and_load_unlocked
module = _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 819, in exec_module
exec(code, module.__dict__)
File "kivy._clock", line 1, in <module>
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\imp.py", line 342, in load_dynamic
return _load(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 696, in _load
return _load_unlocked(spec)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 677, in _load_unlocked
spec.loader.exec_module(module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap_external.py", line 1050, in exec_module
_bootstrap._call_with_frames_removed(_imp.exec_dynamic, module)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 219, in _call_with_frames_removed
return f(*args, **kwds)
File "kivy\_clock.pyx", line 9, in init kivy._clock
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 983, in _find_and_load
return _find_and_load_unlocked(name, import_)
File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib\_bootstrap.py", line 965, in _find_and_load_unlocked
raise ModuleNotFoundError(_ERR_MSG.format(name), name=name)
ModuleNotFoundError: No module named 'kivy.weakmethod'
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#14>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAANLNR3LKOSJZY4OWPMRCTR37GMDANCNFSM4O5PLNRQ>
.
|
Did you get warnings when using Panda's deployment system? What if you explicitly force kivy._clock and kivy.weakmethod to be included in your setup.py? As an aside, is there a reason you're using a 32-bit version of Python? |
Thank you very much for your help With pyinstaller I get this error when executing, and many warnings when compiling .kivy/logs when executing
pyinstaller main.py
If I add kivy._clock and kivy.weakmethod to setup.py (in options = {'plugins': [..., 'kivy._clock', 'kivy.weakmethod']}), the result is the same. I get missing dll warnings warning: build_apps:
output.log
|
Yeah, I'm not that surprised. Kivy's officially supported packaging system
is pyinstaller, while as rdb noted Panda3D has their own method to freeze
executables. There might be issues in each framework when using the other's
packaging system :-/
On that note, I suspect it might be easier to tweak Kivy into behaving with
Panda's system, rather than the other way around - probably less work to do
overall (Kivy being the smaller of the two).
|
Looks like Kivy provides some useful hooks for this kind of thing that PyInstaller is also making use of: https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/hooks/hook-kivy.py. You can try adding these hidden imports to your setup.py: import kivy.tools.packaging.pyinstaller_hooks as kivy_hooks
...
setup(
...
options: {
'build_apps': {
...
include_modules = [
...
] + kivy_hooks.get_deps_all()['hiddenimports'] + list(set(
kivy_hooks.get_factory_modules() + kivy_hooks.kivy_modules + kivy_hooks.hiddenimports
))
}
}
) |
I tried, but So I tried this setup.py, however it doesn't work, I get the same output.log and the same warnings from setuptools import setup
import kivy.tools.packaging.pyinstaller_hooks as kivy_hooks
setup(
name="CalculoUTN",
options={
'build_apps': {
'include_patterns': [
'**/*.png',
'**/*.jpg',
'**/*.egg',
],
'console_apps': {
'CalculoUTN': 'main.py',
},
'platforms': [
'win_amd64'
],
'log_filename': '$USER_APPDATA/CalculoUTN/output.log',
'log_append': False,
'plugins': [
'pandagl',
'Kivy',
'Pillow',
'panda3d_kivy',
'Kivy-Garden',
'kivy-deps.glew',
'kivy-deps.sdl2',
'pywin32',
'numpy'
],
'include_modules': ['kivy._clock', 'kivy.weakmethod'] + kivy_hooks.get_deps_all()['hiddenimports'] + list(set(
kivy_hooks.get_factory_modules() + kivy_hooks.kivy_modules
))
}
}
) |
I feel like you're on the right track, do keep us in touch if you find
anything 🙂
|
Let's keep this issue open for whoever makes progress on packaging for desktop OSes - I changed the title accordingly. Thanks in advance :-) |
I use this lib in the following project
https://github.com/FrancoTonutti/Calculo-UTN-FRP
After trying to compile with
python setup.py bdist_apps
, the generated .exe doesn't workI think the error is due to the following, but I don't know how to compile panda3d and kivy at the same time
[ERROR ] [Clock ] Unable to import kivy._clock. Have you perhaps forgotten to compile kivy? Kivy contains Cython code which needs to be compiled. A missing kivy._clock often indicates the Cython code has not been compiled. Please follow the installation instructions and make sure to compile Kivy
output.log:
The text was updated successfully, but these errors were encountered: