Open FrancoTonutti opened 4 years ago
Use pyinstaller.
Le ven. 17 juil. 2020 à 06:19, FrancoTonutti notifications@github.com 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
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, inFile "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\ConfigParser.py", line 854, in 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 _interpolatesome 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 _interpolatesome 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 File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib_bootstrap.py", line 983, in _find_and_load return _find_and_loadunlocked(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 \win32_cp37m\panda3d_kivy-0.1.2-py3-none-any.whl\panda3d_kivy\app.py", line 2, infrom 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_loadunlocked(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 File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib_bootstrap.py", line 983, in _find_and_load return _find_and_loadunlocked(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 File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib_bootstrap.py", line 983, in _find_and_load return _find_and_loadunlocked(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, inFile "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib_bootstrap.py", line 983, in _find_and_load return _find_and_loadunlocked(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 File "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib_bootstrap.py", line 983, in _find_and_load return _find_and_loadunlocked(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, inFile "C:\Users\Usuario\AppData\Local\Programs\Python\Python37-32\lib\importlib_bootstrap.py", line 983, in _find_and_load return _find_and_loadunlocked(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 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_loadunlocked(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 https://github.com/Cheaterman/panda3d-kivy/issues/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
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 I don't know why I was using that interpreter, now I changed the base interpreter of my venv to to C:\Panda3D-1.10.6-x64\python\python.exe
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 kivy_hooks.hiddenimports
raises an attribute error
AttributeError: module 'kivy.tools.packaging.pyinstaller_hooks' has no attribute 'hiddenimports'
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:
``` [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