0

I'm new to cx_Freeze and need to deploy a Tkinter app (python 2.7.11) as executable on several OS. I successfully deployed my app on Windows, working on 7 and 10 without python installed.

Now I'm struggling with Linux deployment. I successfully built the app, even though the logs give me quite a lot of "Missing modules" :

? Carbon imported from plistlib
? Carbon.File imported from plistlib
? Carbon.Files imported from plistlib
? EasyDialogs imported from getpass
? MacOS imported from platform
? OpenSSL.SSL imported from requests.packages.urllib3.contrib.pyopenssl
? PIL._imagingagg imported from PIL.ImageDraw
? PyQt5.QtCore imported from PIL.ImageQt
? PyQt5.QtGui imported from PIL.ImageQt
? PySide.QtNetwork imported from PySide
? System imported from serial.serialcli
? System.IO.Ports imported from serial.serialcli
? _dummy_threading imported from dummy_threading
? _emx_link imported from os
? _imaging_gif imported from PIL.GifImagePlugin
? _scproxy imported from urllib
? _subprocess imported from subprocess
? _sysconfigdata_d imported from _sysconfigdata
? _winreg imported from main__main__, mimetypes, platform, urllib
? backports.ssl_match_hostname imported from requests.packages.urllib3.packages.ssl_match_hostname
? builtins imported from PIL.GdImageFile, PIL.Image, PIL.ImageMath, PIL.WalImageFile, requests.packages.urllib3.packages.six
? ce imported from os
? certifi imported from requests.certs
? cffi imported from PIL.Image, PIL.PyAccess
? chardet imported from requests.packages
? ctypes.macholib.dyld imported from ctypes.util
? gestalt imported from platform
? http imported from requests.compat
? http.client imported from requests.packages.urllib3.connection
? http.cookies imported from requests.compat
? java.lang imported from platform
? msvcrt imported from getpass, subprocess
? ndg.httpsclient.ssl_peer_verification imported from requests.packages.urllib3.contrib.pyopenssl
? ndg.httpsclient.subj_alt_name imported from requests.packages.urllib3.contrib.pyopenssl
? netbios imported from uuid
? nt imported from ntpath, os
? nturl2path imported from urllib
? org.python.core imported from copy, pickle
? os.path imported from Foobot_Driver, PIL.OleFileIO, main__main__, os, requests.adapters, requests.certs, shlex, shutil
? os2 imported from os
? os2emxpath imported from os
? pathlib imported from PIL.Image
? pyasn1.codec.der imported from requests.packages.urllib3.contrib.pyopenssl
? pyasn1.type imported from requests.packages.urllib3.contrib.pyopenssl
? queue imported from requests.packages.urllib3.connectionpool
? requests.packages.urllib3.packages.six.moves imported from requests.packages.urllib3.response, requests.packages.urllib3.util.response
? riscos imported from os
? riscosenviron imported from os
? riscospath imported from os
? rourl2path imported from urllib
? simplejson imported from requests.compat
? six imported from requests.packages.urllib3.contrib.pyopenssl
? socks imported from requests.packages.urllib3.contrib.socks
? tkinter imported from PIL.ImageTk
? urllib.parse imported from requests.compat, requests.packages.urllib3.poolmanager, requests.packages.urllib3.request
? urllib.request imported from requests.compat
? urllib3 imported from requests.packages
? urllib3.packages.backports.makefile imported from requests.packages.urllib3.contrib.pyopenssl
? vms_lib imported from platform
? win32pipe imported from platform
? win32wnet imported from uuid
? winreg imported from platform

And then, when I try executing the app on my environment, it works perfectly fine. However, if I run it on another environment, I get this :

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.4-py2.7-linux-x86_64.egg/cx_Freeze/initscripts/Console.py", line 27, in <module>
  File "main.py", line 1, in <module>
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
    raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: libBLT.2.5.so.8.6: cannot open shared object file: No such file or directory, please install the python-tk package
vincent@vincent-VirtualBox:/media/sf_MonitorSoft/build/exe.linux-x86_64-2.7$ sudo ./main
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/cx_Freeze-4.3.4-py2.7-linux-x86_64.egg/cx_Freeze/initscripts/Console.py", line 27, in <module>
  File "main.py", line 1, in <module>
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
    raise ImportError, str(msg) + ', please install the python-tk package'
ImportError: libBLT.2.5.so.8.6: cannot open shared object file: No such file or directory, please install the python-tk package

Now, here is my setup file :

from cx_Freeze import setup, Executable
import requests
import sys



# Add certificate to the build
options = {
    "build_exe": {
        'include_files' : [(requests.certs.where(), 'cacert.pem')],
        "includes" : ["Tkinter", "PIL"],
        "packages": ["os", "PIL"]
    }
}



# Dependencies are automatically detected, but it might need fine tuning.

# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
    base = "Win32GUI"

executable = Executable( script = "main.py", base=base )

setup(
    version = "0",
    requires = ["requests"],
    options = options,
    executables = [executable]
)

It is something I found on the internet, with a few modifications after some other internet researches.

And finally, here are the imports made in the original python script :

from Tkinter import *
import serial
import threading as Threading
import Queue as queue
import glob
import time
import itertools
import platform
from Foobot_Driver import Foobot
from PIL import ImageTk, Image
import requests
from StringIO import StringIO
import json
import exceptions
from netifaces import interfaces, ifaddresses, AF_INET,AF_LINK
import itertools
import os.path, time, datetime
from pprint import pprint
import sys

So I tried a couple of solutions, that didn't work out for me, and I'm quite desperate now. If you know anything that could help me, it'd be great. Thanks in advance.

Sogeking
  • 25
  • 1
  • 4
  • try this `sudo apt-get install python-tk` and then run the `setup`. – shivsn Jun 01 '16 at 12:22
  • Well I already did that. Except if you mean on the target environment, in this case, it doesn't help since I want it to run on any computer without any installation to do. Thank you for your help though. – Sogeking Jun 01 '16 at 12:35
  • have a look at this http://stackoverflow.com/a/24268456 hope it helps you. – shivsn Jun 01 '16 at 13:05
  • Thank you, but again, what I am looking for is a solution on the setup and deployment side, not on the target environment. I could just install the missing packages without any problem. But the thing is, I want people to be able to launch it without any further installation, thus the use of cx_Freeze. – Sogeking Jun 01 '16 at 13:10
  • did anyone find a solution? – Michael Oct 15 '18 at 13:53

0 Answers0