j4321 / tkcalendar

Calendar widget for Tkinter
https://pypi.python.org/pypi/tkcalendar
GNU General Public License v3.0
97 stars 33 forks source link

tkcalendar is not packable in any Python to executable system. #79

Open apocalypse2012 opened 2 years ago

apocalypse2012 commented 2 years ago

@VShkaberda The issue is not directly related to tkcalendar, it comes from the fact that Pyinstaller does not detect second level imports. There is a solution to fix it by giving explicit import instructions to Pyinstaller. Since not everybody using tkcalendar uses Pyinstaller I won't add unnecessary imports into tkcalendar's code.

Originally posted by @j4321 in https://github.com/j4321/tkcalendar/issues/40#issuecomment-503027603

I am having this same problem and the posted fix is not working.

pyinstaller --hidden-import babel.numbers main.py

This does not fix the problem. I don't know what has changed, but it is no-longer possible to workaround this.

Python 3.8.5 pip 21.2.4 from p:\documents\depot\autosuspendprocess\venv\lib\site-packages\pip (python 3.8) tkcalendar 1.6.1 pyinstaller 4.5.1

Error message: (venv) P:\Documents\Depot\autosuspendprocess>dist\main\main Traceback (most recent call last): File "main.py", line 1, in import View File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module File "View.py", line 3, in from tkcalendar import DateEntry ModuleNotFoundError: No module named 'tkcalendar' [11492] Failed to execute script 'main' due to unhandled exception!

apocalypse2012 commented 2 years ago

I am still trying to work through this. I am working in Pycharm building in a python virtual environment. I have read all the documentation. I am following all the guidance. Individually and collectively.

Here is my commandline: pyinstaller --clean --onefile --windowed --hidden-import babel.numbers main.spec

Relevant Inline logs: 8398 INFO: Analyzing main.py 8773 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'y:\users\rstewart\appdata\local\programs\python\python3 8-32\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\hook-urllib3.packages.six.moves.py'. 10509 INFO: Analyzing hidden import 'babel.numbers' 10510 ERROR: Hidden import 'babel.numbers' not found

I have both babel.numbers and tkcalendar in the hidden imports of the spec file. I am explicitly importing both in my main.py script. I don't know what else to do except try a different executable packaging solution. That's too bad, because I was hopeful about pyinstaller.

apocalypse2012 commented 2 years ago

Oh... I didn't look at the last update on this project. Apparently this has not been maintained in two years. Another dead project.

apocalypse2012 commented 2 years ago

It looks like Py2Exe, nuitka, none of them with package this monster. What did you do to make this impossible to include?

sambath-krian commented 1 year ago

pyinstaller.exe --hidden-import babel.numbers --windowed VideoAudioCaptureFrontend_V4.py not working, could you please help us to resolve the issue

Traceback (most recent call last): File "VideoAudioCaptureFrontend_V4.py", line 16, in ModuleNotFoundError: No module named 'tkcalendar'

sambath-krian commented 1 year ago

in source fileia hve added hiddenimports=["tkinter.ttk", "tkinter.font", "babel.numbers" , "tkcalendar"] as well still i am getting same issue as mentioned above

VantaTree commented 1 year ago

I was able to get tkcalendar into an exe with pyinstaller by adding data: --add-data "<path to python>/Lib/site-packages/tkcalendar;tkcalendar" --add-data "<path to python>/Lib/site-packages/babel;babel"

This included babel/numbers.py which seemed to solve the problem, or you can manually copy-paste it from site-packages (no need to add data babel).