Pyinstaller No Module Tkinter

January 04, 2017, at 04:50 AM

I have created a python script using Tkinter and am trying to package it using a Mac with Pyinstaller. Pyinstaller creates the executable but when I try to run it says the Tkinter module is missing. I realize there are several similar questions like this on SO but none of the solutions have worked for me.

Here is the top of my script:

#!/usr/bin/env python
import sys
import os
import traceback
import json
import time
import Tkinter

Here is my pyinstaller version:

$ pyinstaller --version

I run pyinstaller with this command:

$ pyinstaller 

Here is the output of that command:

30 INFO: PyInstaller: 3.3.dev0+483c819
30 INFO: Python: 3.4.3
34 INFO: Platform: Darwin-15.6.0-x86_64-i386-64bit
35 INFO: wrote /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/main.spec
36 INFO: UPX is not available.
38 INFO: Extending PYTHONPATH with paths
38 INFO: checking Analysis
38 INFO: Building Analysis because out00-Analysis.toc is non existent
38 INFO: Initializing module dependency graph...
39 INFO: Initializing module graph hooks...
40 INFO: Analyzing ...
1395 INFO: Processing pre-find module path hook   distutils
2445 INFO: running Analysis out00-Analysis.toc
2452 INFO: Caching module hooks...
2454 INFO: Analyzing /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/
2499 INFO: Loading module hooks...
2499 INFO: Loading module hook ""...
2553 INFO: Loading module hook ""...
2553 INFO: Loading module hook ""...
2753 INFO: Loading module hook ""...
2766 INFO: Looking for ctypes DLLs
2766 INFO: Analyzing run-time hooks ...
2773 INFO: Looking for dynamic libraries
2836 INFO: Looking for eggs
2836 INFO: Using Python library /Library/Frameworks/Python.framework/Versions/3.4/Python
2838 INFO: Warnings written to /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/warnmain.txt
2861 INFO: checking PYZ
2861 INFO: Building PYZ because out00-PYZ.toc is non existent
2861 INFO: Building PYZ (ZlibArchive) /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/out00-PYZ.pyz
3175 INFO: checking PKG
3176 INFO: Building PKG because out00-PKG.toc is non existent
3176 INFO: Building PKG (CArchive) out00-PKG.pkg
3185 INFO: Bootloader /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/bootloader/Darwin-64bit/run
3185 INFO: checking EXE
3185 INFO: Building EXE because out00-EXE.toc is non existent
3185 INFO: Building EXE from out00-EXE.toc
3185 INFO: Appending archive to EXE /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/main
3187 INFO: Fixing EXE for code signing /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/main
3192 INFO: checking COLLECT
3192 INFO: Building COLLECT because out00-COLLECT.toc is non existent
3192 INFO: Building COLLECT out00-COLLECT.toc

When I run the executable a terminal window opens with the following output:

Last login: Tue Jan  3 11:35:51 on ttys004
/Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/dist/main/main ; exit;
[11:43:24][~]$ /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/dist/main/main ; exit;
Traceback (most recent call last):
  File "", line 7, in <module>
ImportError: No module named 'Tkinter'
Failed to execute script main
Saving session...
...copying shared history...
...saving history...truncating history files...
[Process completed]

I have tried running the pyinstaller command with --hidden-import Tkinter but that still does not work. I have checked the pyinstaller docs section "When Things Go Wrong" but still don't see a solution.

TensorFlow: Specifying storage of layer activations

TensorFlow: Specifying storage of layer activations

Motivation: It's easy to imagine a scenario where one could amass a large number of layers so as to overwhelm a GPU's memory capacity

Connection Error python mpd python-mpd2 0.5.1 WinError 10061

Connection Error python mpd python-mpd2 0.5.1 WinError 10061

I am trying to use mpd in pythonI am not able to connect

How to run Kivy and the XLRD module properly

How to run Kivy and the XLRD module properly

I am attempting to make a very simple app in Kivy using the xlrd moduleI have an excel spreadsheet with some data and I want to show the cell (2,1) as a label

universal xpath for find the elements below

universal xpath for find the elements below

I am trying to find the th(by text) using the XPathThe problem is i need to define 3 xpath seprately to find the th by text as below: