enthought / traitsui

TraitsUI: Traits-capable windowing framework
http://docs.enthought.com/traitsui
Other
297 stars 95 forks source link

qt4 toolkit plugin not found when using pyinstaller #458

Open jamanabanana opened 6 years ago

jamanabanana commented 6 years ago

I'm not sure if this would fit better under pyinstaller or traitsui, but essentially when I try to build an exe using pyinstaller the resultant exe file raises an exception:

RuntimeError: No traitsui.toolkits plugin found for toolkit qt4

The first two lines of my program are:

from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'

The program works fine when run in a python environment, so think I just need to add a hidden-import, but I can't find what file it would be looking for since there is no toolkits folder or toolkits.py file in the traitsui folder, but there is a qt4 folder. It just doesn't seem to be looking there.

For reference, I am attempting to import mayavi but it always gets stuck on this step. Before I added the ETSConfig line, it was the same error but with null instead of qt4. The whole traceback is below:

  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\mayavi\mlab.py", line 27, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\mayavi\tools\camera.py", line 24, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\mayavi\tools\engine_manager.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\mayavi\preferences\api.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\mayavi\preferences\preference_manager.py", line 29, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\traitsui\api.py", line 36, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\traitsui\editors\__init__.py", line 23, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\traitsui\editors\api.py", line 24, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 631, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\traitsui\editors\code_editor.py", line 37, in <module>
  File "site-packages\traitsui\editors\code_editor.py", line 49, in ToolkitEditorFactory
  File "site-packages\traits\traits.py", line 522, in __call__
  File "site-packages\traits\traits.py", line 1236, in Color
  File "site-packages\traitsui\toolkit_traits.py", line 8, in ColorTrait
  File "site-packages\traitsui\toolkit.py", line 109, in toolkit
  File "site-packages\pyface\base_toolkit.py", line 263, in find_toolkit
  File "site-packages\pyface\base_toolkit.py", line 209, in import_toolkit
RuntimeError: No traitsui.toolkits plugin found for toolkit qt4
corranwebster commented 6 years ago

I'm not that familiar with PyInstaller, but Pyface and Traitsui use indirect importing of the backend toolkit via setuptools entrypoints, so I'm guessing that you probably need to tell PyInstaller to include the modules from the qt4 entry points in pyface (https://github.com/enthought/pyface/blob/master/setup.py#L173) and traitsui (https://github.com/enthought/traitsui/blob/master/setup.py#L147)

But there may be some other places as well where there is code doing differential imports of qt vs. wx; most likely in Envisage, Apptools and Mayavi as well. These currently don't use the extension point mechanisms, so there is no unified place to go looking for things, unfortunately.

jamanabanana commented 6 years ago

I have added the modules you suggested but the problem persists. It just seems to me that it is looking somewhere that doesn't exist since it says traitsui.toolkits and there is no toolkits folder or file in traitsui folder.

corranwebster commented 6 years ago

The traitsui.toolkits in this context is not a module, but the name of the setuptools/pkgresources entry point for the plugins.

jamanabanana commented 6 years ago

Well I'm grasping at straws but I might have something...

Going through the traceback, I noticed that this all starts by trying to set a marker_color (in traitsui\editors\code_editor.py). Working my way down the rabbit hole, I found that the Color function/method (in traits\traits.py on line 1218) only makes reference to wxPython in the comments... Is there some issue where qt is not supported fully?

def Color ( *args, **metadata ):
    """ Returns a trait whose value must be a GUI toolkit-specific color.

    Description
    -----------
    For wxPython, the returned trait accepts any of the following values:

    * A wx.Colour instance
    * A wx.ColourPtr instance
    * an integer whose hexadecimal form is 0x*RRGGBB*, where *RR* is the red
      value, *GG* is the green value, and *BB* is the blue value

    Default Value
    -------------
    For wxPython, 0x000000 (that is, white)
    """
    from traitsui.toolkit_traits import ColorTrait

    return ColorTrait( *args, **metadata )
rkern commented 6 years ago

No, just a stale docstring. The actual behavior is deferred to the selected toolkit.

jamanabanana commented 6 years ago

Well where/what should I be looking for to know if I even have the plugin? As the error states, it can't find a traitsui.toolkits plugin for qt4, so how can I know where it is looking / what it is looking for? It doesn't list a file location or expected file name so I don't know how to proceed...

rkern commented 6 years ago

There should be a traitsui-<version>.egg-info/ directory under site-packages. Inside of it should be a file named entry_points.txt. That file should have contents like the following:

[traitsui.toolkits]
null = traitsui.null:toolkit
qt = traitsui.qt4:toolkit
qt4 = traitsui.qt4:toolkit
wx = traitsui.wx:toolkit
jamanabanana commented 6 years ago

OK thank you. I see that text file, but there doesn't appear to be line breaks between the entries. Would that be an issue? I opened it with Notepad on Windows. However, when I copy it into here the line breaks appear.

[traitsui.toolkits]
null = traitsui.null:toolkit
qt = traitsui.qt4:toolkit
qt4 = traitsui.qt4:toolkit
wx = traitsui.wx:toolkit
jamanabanana commented 6 years ago

But if I need to point to that file to freeze with the rest of the modules, the periods in the folder name are becoming an issue...

corranwebster commented 6 years ago

I would suggest looking into the PyInstaller documentation and other related resources about how it handles pkg_resources entry points. This link seems like it might be relevant: https://pythonhosted.org/PyInstaller/hooks.html?highlight=pkg_resources

Including things accessed by pkg_resources must be a fairly standard, if advanced, thing to do with PyInstaller so there should be information somewhere.

jamanabanana commented 6 years ago

Well I was able to get around this issue, but I'm not sure what exactly is different. I ended up going to an Anaconda Python 3.5.5 environment and reinstalling a few different versions of everything until it worked. I also had to use cx_freeze instead of pyinstaller. I used all of the same hidden-imports/includes between cx_freeze and pyinstaller so the one must just be better at the indirect imports.

xavfaure commented 6 years ago

I encountered the same issue but without any solution at the moment. I need to make a standalone application with PyQt5, mayavi 4.6.1 traisui6.0.0 and a lot of others, using python 3.6. After some tries with PYinstaller without any success I tried cx_freeze. Here again after several tries I managed to get up to the same error as above (No trauitsui.toolkits plugin found for toolkit qt4). I've tried with qt instead of qt4 : same message... I've read plenty of posted issues without getting the solution to this one... I guess it can come from : os.environ['ETS_TOOLKIT'] ?

corranwebster commented 6 years ago

Using qt vs. qt4 shouldn't matter (they should import the same backend). Ensure that you tell cx_freeze to include the pyface.ui.qt4 package and its subpackages (even though you are targeting qt5, the qt4 backend works). Beyond that, I'm not sure, there are a lot of things that go on during toolkit initialization that could cause the import to fail, such as starting the application.

You might try setting the QT_API environment variable to pyqt5 if it isn't already set.

Beyond that, I'm not familiar with cx_freeze, so I'm not sure what else to add.

xavfaure commented 6 years ago

Thanks for the quick answer but yes, the setup.py file include the following packages :

_package = ['pyface.ui.qt4', 'tvtk.vtk_module', 'matplotlib.backends.backend_qt5','pkg_resources._vendor',
           'pkg_resources.extern','pygments.lexers', 'tvtk.pyface.ui.qt4',
           'pyface.qt','pyface.qt.QtGui','pyface.qt.QtCore','numpy',
           'matplotlib','mayavi', 'traits', 'traitsui', 'sip', 'packaging',
           'traitlets', 'xlrd', 'scipy.linalg', 'scipy', 'pkg_resources._vendor']
excludes = ['gtk', 'Tkinter', 'wx']
includes = ['atexit', 'appdirs', 'PyQt5', 'PyQt5.QtCore', 'PyQt5.QtGui', 
            'PyQt5.QtWidgets', 'packaging.specifiers', 'traitsui.toolkit', 'scipy.linalg']_

The QT_API path is refered to pyqt5 indeed. I've tried many things and migth have missed coupled solutions somewhere. So If anyone has some other proposal I would be gratefull

corranwebster commented 6 years ago

You might need to have more PyQt5.* includes. Pyface imports from various places to adapt the Qt5 API to be approximately compatible with the Qt4 API. Look in pyface.qt.Qt* for what is actually imported. I would suspect that you will need at least PyQt5.Qt, PyQt5.QtPrintSupport and possibly PyQt5.QtWebEngine and PyQt5.QtWebEngineWidgets.

ETA: and possibly PyQt5.QtOpenGL since you are using Mayavi (not sure about that one).

xavfaure commented 5 years ago

I've tried to had different modules with no success up to now. This is my setup.py

import sys
from cx_Freeze import setup, Executable
import os
import scipy

path = sys.path
# Dependencies are automatically detected, but it might need fine tuning.
package = ['pyface.ui.qt4', 'tvtk', 'pkg_resources._vendor',
           'pkg_resources.extern','pygments.lexers', 'tvtk.pyface.ui.qt4',
           'pyface.qt','numpy',
           'matplotlib','mayavi', 'traits', 'traitsui', 'sip', 'packaging',
           'traitlets', 'xlrd', 'scipy', 'scipy.linalg','PyQt5']

excludes = ['gtk', 'Tkinter', 'wx']
includes = ['matplotlib.backends.backend_qt5','tvtk.vtk_module', 'atexit', 'appdirs', 
            'packaging.specifiers', 'traitsui.toolkit', 'traitsui.toolkit_traits', 'mayavi.mlab',
            'pyface.qt.QtCore','pyface.qt.QtGui', 'pyface.qt.QtNetwork', 'pyface.qt.QtOpenGL', 'pyface.qt.QtScript', 'pyface.qt.QtSvg', 'pyface.qt.QtTest', 'pyface.qt.QtWebKit',
            'PyQt5.QtCore', 'PyQt5.QtGui', 'PyQt5.Qt', 'PyQt5.QtWidgets', 'PyQt5.QtOpenGL', 'PyQt5.QtSvg', 'PyQt5.QtTest',
            'PyQt5.QtPrintSupport', 'PyQt5.QtWebEngine', 'PyQt5.QtWebEngineWidgets']

scipy_path = os.path.dirname(scipy.__file__)
includefiles = [(str(scipy_path), "scipy")]
build_exe_options = {"packages": package, 
                     "excludes": excludes, 
                     "includes": includes,
                     "include_files": includefiles,
                     "namespace_packages": ['mayavi']
                     }

os.environ['ETS_TOOLKIT'] = 'qt'
os.environ['TCL_LIBRARY'] = r'C:\\Users\\xf245257\\AppData\\Local\\Continuum\\anaconda3\\envs\\NatuVent_dev\\tcl\\tcl8.6'   
os.environ['TK_LIBRARY'] = r'C:\\Users\\xf245257\\AppData\\Local\\Continuum\\anaconda3\\envs\\NatuVent_dev\\tcl\tk8.6'

filename = r'C:\\Users\\xf245257\\Documents\\FAURE\\Soft\\NatuVent_Jules\\NatuVent\\NatuVent.py'
icon_path = r'C:\\Users\\xf245257\\Documents\\FAURE\\Soft\\NatuVent_Jules\\NatuVent\\GUI\\logo_black.png'

base = None 
if sys.platform == "win32":
    base = "Win32GUI"

cible = Executable(
    script = filename,
    targetName='NatuVent.exe',
    base = base,
    )

setup(name = "NatuVent",
      version = "0.1",
      description = "NatuVent GUI for natural ventilation potential assessment!",
      options = {"build_exe": build_exe_options},
      executables = [cible])

there is no error during cx-freeze process but when lauching the .exe file I get the following window screenhunter_121 oct 08 11 09

So it also migth come from the MayaviQWidget which is a classe in my graphical_core script. The app include mayavi object into widget of PyQT. Do I have to include the prgm also in the setup ??? I'm a bit loss....

corranwebster commented 5 years ago

This looks like the problem is during the first import which decides the toolkit. Some suggestions:

The latter would look something like:

# set correct Qt version
import os
os.environ['QT_API'] = 'pyqt5'

# more informative error messages (remove when working)
os.environ['ETS_DEBUG'] = '1'

# set correct ETS toolkit version
from traits.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'  # this works even if using Qt5

# force setup of toolkit (optional, but this will fail early if not right)
import pyface.api

even if this doesn't work it should give you a better idea of what is going wrong.

xavfaure commented 5 years ago

Thanks again but I didn't manage to solve the issue... The os.environ['ETS_DEBUG'] = '1' gives me the "ModuleNotFounderror" from pyface.ui.qt4.expandable_panel.... Isn't it a path problem ? I've reversed some import between mayavi, traitsui and tvtk. because as I included some print the traitsui.toolkit.py and pyface.base_toolkit.py to follow the variables and their path I saw that while lauching my main prgm these three were going through the same prgm. The path for all three was .._lib\ntpath.py. And everything works perfectly when lauching the main prgm in a prompt console. After making the exe file, as I put mayavi at fisrst, the pyface.toolkit was not found, as I put tvtk import at first, it was tvtk.toolkit that was not found and, at last, if traitsui was the first import the traitsui.toolkit had pb. the path were for each 'xxx\build\exe.win-amd64-3.6\lib\library.zip\ntpath.pyc' but the path that are printed in the error figure I've added in the above message does not mention the build floder... Am I in a wrong way or is there simply a path problem during the .exe construction process ? I report errors in a separate file and this one is always empty (the process's going well for cx_freeze). An idea ?

corranwebster commented 5 years ago

The expandable_panel is just noise - there's no Qt version of that widget, so you will get a complaint from the ETS_DEBUG about that.

This is looking like an issue with pkg_resources not working properly with cx_freeze or vice-versa. It is looking for the toolkit plugin entrypoint in this line plugins = list(pkg_resources.iter_entry_points(entry_point, toolkit_name)) and getting nothing back. So you need to work out how to make pkg_resources entry points work with cx_freeze. My guess is that you probably need to include the entry_points.txt files in the egg_info directories that Robert mentioned above for at least pyface, traitsui, and possibly mayavi/tvtk.

Including entrypoints ought to be a fairly standard thing for cx_freeze, but google searches were not helping much.

corranwebster commented 5 years ago

It seems like cx_freeze is not compatible with standard pkg_resources entry points. See https://github.com/anthony-tuininga/cx_Freeze/issues/216 Thanks to @itziakos for digging this up.

xavfaure commented 5 years ago

thanks for the link, I'll asked how the solve the issue. The doc wasn't that clear for me on how can I specify particular conditions for cx_freeze.

xavfaure commented 5 years ago

Im' posting a nexw message on this issue. I've manage to get same error using cx_freeze and Pyinstaller. As above, depending on the import order (traitsui, mayavi and tvtk), I get RuntimeError: No xxxx.toolkits plugin found for toolkit qt4 with the xxx replaced by traitsui, pyface or tvtk.... I've include in the setup file for cx_freeze the above recommendations, but I didn't used the .spec file for pysinstaller as I don't really know what to specify on what part. Does anyone have any idea ? I've tryed to donwgrade to python 3.5 but with no success. I'll tryied python 3.5.5 as above. Thanks to this fex days pb I create several environment and i'm not using conda anymore (conflcit between pip and conda for the different environment.

corranwebster commented 5 years ago

I'm not hopeful that cx_freeze will work for you. For PyInstaller, something like the approach described in this issue https://github.com/pyinstaller/pyinstaller/issues/3050 might help (it will need to be more sophisticated, as instead of 'xxx.subcmd' in that example you have to handle 'pyface.toolkits', 'traitsui.toolkits', etc.)

We don't use Pyinstaller/cx_freeze/etc. for our application deployment, but we've had some internal discussions about how to handle this incompatibility with pkg_resources more gracefully within ETS code.

xavfaure commented 5 years ago

Do you have any other options for application deployment ? I learned about cx_freeze and pysintaller only last week, so I can change wihtou any pb !

corranwebster commented 5 years ago

One option, if you are willing to consider it, is to use the previous releases of TraitsUI, Pyface, and Mayavi - the pkg_resources changes are new in version 6. Unfortunately you will need to use Qt4 instead of Qt5, but things should otherwise work transparently. You will still need to tell PyInstaller about all the hidden imports.

I think PyInstaller may be your best bet to get something working; or Py2App if you want to deploy on MacOS.

dhabbyc commented 5 years ago

I had the same problem with cz_freeze and traitsui (pyqt4 backend, on windows). I wrote an hugly hack to get it working:

PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
packages = ['apptools', 'configobj', 'envisage', 'mayavi', 'numpy', 'pygments','six', 'traits', 'traitsui','vtk','pyface']
base_path = os.path.join(PYTHON_INSTALL_DIR, 'Lib','site-packages')

folders = list(next(os.walk(base_path))[1])
folders = [fol for fol in folders if fol.endswith('-info')]
folders = [fol for fol in folders if fol.split('-')[0].lower() in packages ]
out = [f for f in folders]
folders = [os.path.join(base_path, fol) for fol in folders]
folders = [(fol, '.\\lib' + '\\' + out[k]) for k, fol in enumerate(folders)]

# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {
    "packages": ['sys', 'os', 'ctypes','platform', 'sip', 'shutil', 'numpy', 'traits', 'traits.api', 'mayavi', 'mayavi.core',
    'traitsui','traitsui.qt4.toolkit',
    'mayavi.core.ui', 'mayavi.core.ui.api', 'tvtk', 'tvtk.tools', 'tvtk.api', 'json', 'math', 'time', 'sqlite3', 'pyface', 'pyface.ui',
    'pyface.ui.qt4',
    'pkg_resources','pyface.qt.QtGui','pyface.qt.QtCore','pkg_resources._vendor','pkg_resources.extern',"tvtk.pyface.ui.qt4",
    'pkg_resources._vendor','pkg_resources.extern', 
    'pkg_resources', 'pygments'], 
    "excludes": [],
    "includes": [],
    "include_files": folders
}
jgwacyk commented 4 years ago

I had the same problem with cz_freeze, pyface and mayavi (pyqt5 backend, on windows). I guess the problem comes from that it use pkg_resources package that needs the .egg-info files to import the package. So I create a venv with all my dependancy on it, after I generate the build folder with the exe with this setup :

import os
from cx_Freeze import setup, Executable
import cx_Freeze.hooks
def hack(finder, module):
    return
cx_Freeze.hooks.load_matplotlib = hack
import scipy
import matplotlib
import PyQt5.Qt

os.environ['ETS_TOOLKIT'] = 'qt4'
os.environ['QT_API'] = 'pyqt5'
scipy_path = os.path.dirname(scipy.__file__) 
pyqt5_path = os.path.dirname(PyQt5.Qt.__file__)

build_exe_options = {"packages": ["sys", "os", "glob",'subprocess',"pyface.ui.qt4", "tvtk.vtk_module", "tvtk.pyface.ui.wx", "matplotlib.backends.backend_qt4",'pygments.lexers',
                                  'tvtk.pyface.ui.qt4','pyface.qt','pyface.qt.QtGui','pyface.qt.QtCore',
                                  'openpyxl','scipy','matplotlib','numpy','math','matplotlib','mayavi',"statistics","sympy","mplcursors","traitsui","pyface"],
                     "include_files": [(str(scipy_path), "scipy"), (str(pyqt5_path), "PyQt5.Qt"), (matplotlib.get_data_path(), "mpl-data")],
                     "includes":['mayavi','PyQt5'],
                     'excludes':'Tkinter',
                    "namespace_packages": ['mayavi']
                    }

executables = [
    Executable('Test.py', targetName="Test.exe",base = 'Win32GUI',)
]

setup(name='Test',
      version='1.0',
      description='',
      options = {"build_exe": build_exe_options},
      executables=executables,
      )

After I copied all the files from the folder venv\Lib\sites-packages to build\exe\lib

It worked for me. Good luck :)

rahulporuri commented 4 years ago

@jgwacyk i edited your comment and added formatting to make it easier to read. I hope that's okay.

jgwacyk commented 4 years ago

@jgwacyk i edited your comment and added formatting to make it easier to read. I hope that's okay.

It's perfect. Thanks 👍

Jack32768 commented 3 years ago

I had the same problem with cz_freeze, pyface and mayavi (pyqt5 backend, on windows). I guess the problem comes from that it use pkg_resources package that needs the .egg-info files to import the package. So I create a venv with all my dependancy on it, after I generate the build folder with the exe with this setup :

import os
from cx_Freeze import setup, Executable
import cx_Freeze.hooks
def hack(finder, module):
    return
cx_Freeze.hooks.load_matplotlib = hack
import scipy
import matplotlib
import PyQt5.Qt

os.environ['ETS_TOOLKIT'] = 'qt4'
os.environ['QT_API'] = 'pyqt5'
scipy_path = os.path.dirname(scipy.__file__) 
pyqt5_path = os.path.dirname(PyQt5.Qt.__file__)

build_exe_options = {"packages": ["sys", "os", "glob",'subprocess',"pyface.ui.qt4", "tvtk.vtk_module", "tvtk.pyface.ui.wx", "matplotlib.backends.backend_qt4",'pygments.lexers',
                                  'tvtk.pyface.ui.qt4','pyface.qt','pyface.qt.QtGui','pyface.qt.QtCore',
                                  'openpyxl','scipy','matplotlib','numpy','math','matplotlib','mayavi',"statistics","sympy","mplcursors","traitsui","pyface"],
                     "include_files": [(str(scipy_path), "scipy"), (str(pyqt5_path), "PyQt5.Qt"), (matplotlib.get_data_path(), "mpl-data")],
                     "includes":['mayavi','PyQt5'],
                     'excludes':'Tkinter',
                    "namespace_packages": ['mayavi']
                    }

executables = [
    Executable('Test.py', targetName="Test.exe",base = 'Win32GUI',)
]

setup(name='Test',
      version='1.0',
      description='',
      options = {"build_exe": build_exe_options},
      executables=executables,
      )

After I copied all the files from the folder venv\Lib\sites-packages to build\exe\lib

It worked for me. Good luck :)

For reference here, I did not use the setup file and I just simply copied all packages from site-package to the lib directory then it worked for me.

kmhase commented 3 years ago

I had the same problem with cz_freeze, pyface and mayavi (pyqt5 backend, on windows). I guess the problem comes from that it use pkg_resources package that needs the .egg-info files to import the package. So I create a venv with all my dependancy on it, after I generate the build folder with the exe with this setup :

import os
from cx_Freeze import setup, Executable
import cx_Freeze.hooks
def hack(finder, module):
    return
cx_Freeze.hooks.load_matplotlib = hack
import scipy
import matplotlib
import PyQt5.Qt

os.environ['ETS_TOOLKIT'] = 'qt4'
os.environ['QT_API'] = 'pyqt5'
scipy_path = os.path.dirname(scipy.__file__) 
pyqt5_path = os.path.dirname(PyQt5.Qt.__file__)

build_exe_options = {"packages": ["sys", "os", "glob",'subprocess',"pyface.ui.qt4", "tvtk.vtk_module", "tvtk.pyface.ui.wx", "matplotlib.backends.backend_qt4",'pygments.lexers',
                                  'tvtk.pyface.ui.qt4','pyface.qt','pyface.qt.QtGui','pyface.qt.QtCore',
                                  'openpyxl','scipy','matplotlib','numpy','math','matplotlib','mayavi',"statistics","sympy","mplcursors","traitsui","pyface"],
                     "include_files": [(str(scipy_path), "scipy"), (str(pyqt5_path), "PyQt5.Qt"), (matplotlib.get_data_path(), "mpl-data")],
                     "includes":['mayavi','PyQt5'],
                     'excludes':'Tkinter',
                    "namespace_packages": ['mayavi']
                    }

executables = [
    Executable('Test.py', targetName="Test.exe",base = 'Win32GUI',)
]

setup(name='Test',
      version='1.0',
      description='',
      options = {"build_exe": build_exe_options},
      executables=executables,
      )

After I copied all the files from the folder venv\Lib\sites-packages to build\exe\lib

It worked for me. Good luck :)

This worked for me. jgwacyk you really are a lifesaver thanks a lot.

yoda-vid commented 3 years ago

Thanks for the above tips. They were really helpful to get it working for me on both cx_Freeze and PyInstaller.

There may be a more efficient way to add just the necessary files, but this way at least worked for me.

lizhuang2511 commented 1 year ago

I want use traitsui .but I can't create exe use pyinstaller. because I get same mistake as above .can you help me .if can't slove this problem I clound direct use pyqt5..why

corranwebster commented 1 year ago

For PyInstaller, there was a SciPy tutorial last year that included PyInstaller instructions and examples, which may be useful: https://github.com/jonathanrocher/ets_tutorial

lizhuang2511 commented 1 year ago

my python is 3.8.10 use https://github.com/jonathanrocher/ets_tutorial.the problem unsolved keyerror traitsui.toolkits

lizhuang2511 commented 1 year ago

my pyinstaller process 361 INFO: PyInstaller: 4.10 361 INFO: Python: 3.8.10 1037 INFO: Platform: Windows-10-10.0.19042-SP0 1039 INFO: UPX is not available. Traceback (most recent call last): File "", line 21, in walk_packages File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Lib\site-packages\shiboken2\files.dir\shibokensupport__feature__.py", line 142, in _import return original_import(name, *args, *kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\traitsui\wx__init.py", line 19, in from . import toolkit File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Lib\site-packages\shiboken2\files.dir\shibokensupport\feature__.py", line 142, in _import return original_import(name, args, **kwargs) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\traitsui\wx\toolkit.py", line 20, in assert_toolkit_import(["wx"]) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\traitsui\toolkit.py", line 39, in assert_toolkit_import raise RuntimeError( RuntimeError: Importing from wx backend after selecting qt4 backend! collect_submodules: failed to import 'traitsui.wx'! 5512 INFO: Extending PYTHONPATH with paths ['E:\mechanical-calculation-4\程序文件\齿轮几何计算', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Lib\site-packages\traitsui-7.4.2.dist-info', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\Lib\site-packages\pyface-8.0.0.dist-info'] 6819 INFO: checking Analysis 6819 INFO: Building Analysis because Analysis-00.toc is non existent 6819 INFO: Initializing module dependency graph... 6823 INFO: Caching module graph hooks... 6827 WARNING: Several hooks defined for module 'lark'. Please take care they do not conflict. 6838 INFO: Analyzing base_library.zip ... 8902 INFO: Processing pre-find module path hook distutils from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\pre_find_module_path\hook-distutils.py'. 8902 INFO: distutils: retargeting to non-venv dir 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib' 11563 INFO: Caching module dependency graph... 11753 INFO: running Analysis Analysis-00.toc 11765 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable required by C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.exe 11970 INFO: Analyzing E:\mechanical-calculation-4\程序文件\齿轮几何计算\chilun.py 12096 INFO: Processing pre-safe import module hook win32com from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\pre_safe_import_module\hook-win32com.py'. 12235 INFO: Processing pre-find module path hook site from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\pre_find_module_path\hook-site.py'. 12236 INFO: site: retargeting to fake-dir 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\fake-modules' 23152 INFO: Processing pre-safe import module hook six.moves from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\hook-six.moves.py'. 50154 INFO: Analyzing hidden import 'mpl_toolkits.axes_grid1' 50248 INFO: Analyzing hidden import 'mpl_toolkits.axisartist' 50366 INFO: Analyzing hidden import 'sympy' 65997 INFO: Analyzing hidden import 'geatpy' 69897 INFO: Analyzing hidden import 'xlwings' 70344 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\hook-urllib3.packages.six.moves.py'. 72685 INFO: Analyzing hidden import 'Pyface' 72687 ERROR: Hidden import 'Pyface' not found 72687 INFO: Processing module hooks... 72687 INFO: Loading module hook 'hook-certifi.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 72692 INFO: Loading module hook 'hook-charset_normalizer.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 72693 INFO: Loading module hook 'hook-llvmlite.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 72699 INFO: Loading module hook 'hook-lxml.etree.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 72700 INFO: Loading module hook 'hook-lxml.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 73221 INFO: Loading module hook 'hook-numba.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 73240 INFO: Loading module hook 'hook-openpyxl.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 73420 INFO: Loading module hook 'hook-py.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 73615 INFO: Loading module hook 'hook-pyarrow.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 74143 WARNING: Hidden import "pyarrow.compat" not found! 74143 INFO: Loading module hook 'hook-pycparser.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 74144 INFO: Loading module hook 'hook-pytest.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 74586 INFO: Loading module hook 'hook-pythoncom.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 76389 INFO: Loading module hook 'hook-pywintypes.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 78209 INFO: Loading module hook 'hook-tables.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 78210 INFO: Loading module hook 'hook-win32com.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 78210 INFO: Loading module hook 'hook-difflib.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78217 INFO: Loading module hook 'hook-distutils.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78218 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78223 INFO: Loading module hook 'hook-encodings.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78304 INFO: Loading module hook 'hook-heapq.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78315 INFO: Loading module hook 'hook-importlib_metadata.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78316 INFO: Loading module hook 'hook-importlib_resources.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78317 WARNING: Hidden import "importlib_resources.trees" not found! 78317 INFO: Loading module hook 'hook-lib2to3.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 78371 INFO: Loading module hook 'hook-matplotlib.backends.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 80406 INFO: Matplotlib backend "GTK3Agg": ignored backend Gtk3Agg requires cairo 81365 INFO: Matplotlib backend "GTK3Cairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffi is installed 82330 INFO: Matplotlib backend "GTK4Agg": ignored backend Gtk4Agg requires cairo 83320 INFO: Matplotlib backend "GTK4Cairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffi is installed 84313 INFO: Matplotlib backend "MacOSX": ignored cannot import name '_macosx' from 'matplotlib.backends' (C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\backends__init__.py) 85292 INFO: Matplotlib backend "nbAgg": ignored No module named 'IPython' 86427 INFO: Matplotlib backend "QtAgg": added 87426 INFO: Matplotlib backend "QtCairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffi is installed 88558 INFO: Matplotlib backend "Qt5Agg": added 89502 INFO: Matplotlib backend "Qt5Cairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffi is installed 90913 INFO: Matplotlib backend "TkAgg": added 92348 INFO: Matplotlib backend "TkCairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffi is installed 93521 INFO: Matplotlib backend "WebAgg": added 94905 INFO: Matplotlib backend "WX": added 96313 INFO: Matplotlib backend "WXAgg": added 97420 INFO: Matplotlib backend "WXCairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffi is installed 98541 INFO: Matplotlib backend "agg": added 99517 INFO: Matplotlib backend "cairo": ignored cairo backend requires that pycairo>=1.11.0 or cairocffi is installed 100976 INFO: Matplotlib backend "pdf": added 102458 INFO: Matplotlib backend "pgf": added 103622 INFO: Matplotlib backend "ps": added 104693 INFO: Matplotlib backend "svg": added 106116 INFO: Matplotlib backend "template": added 109110 INFO: Loading module hook 'hook-matplotlib.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 110188 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 110196 INFO: Loading module hook 'hook-numpy.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 110263 INFO: Import to be excluded not found: 'f2py' 110293 INFO: Loading module hook 'hook-numpy._pytesttester.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 110299 INFO: Loading module hook 'hook-packaging.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 110300 INFO: Loading module hook 'hook-pandas.io.formats.style.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 110747 INFO: Loading module hook 'hook-pandas.plotting.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 110912 INFO: Loading module hook 'hook-pandas.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 112188 INFO: Loading module hook 'hook-pickle.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 112196 INFO: Loading module hook 'hook-PIL.Image.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 112420 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 112428 INFO: Loading module hook 'hook-PIL.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 112450 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 112455 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 113655 WARNING: Hidden import "pkg_resources.py2_warn" not found! 113655 WARNING: Hidden import "pkg_resources.markers" not found! 113663 INFO: Loading module hook 'hook-pygments.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 115409 INFO: Loading module hook 'hook-PyQt5.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 115643 INFO: Loading module hook 'hook-PyQt5.Qt.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 115708 INFO: Loading module hook 'hook-PyQt5.QtCore.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 115789 INFO: Loading module hook 'hook-PyQt5.QtGui.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 115988 INFO: Loading module hook 'hook-PyQt5.QtHelp.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 116518 INFO: Loading module hook 'hook-PyQt5.QtLocation.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 117163 INFO: Loading module hook 'hook-PyQt5.QtMultimedia.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 117658 INFO: Loading module hook 'hook-PyQt5.QtMultimediaWidgets.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 118161 INFO: Loading module hook 'hook-PyQt5.QtNetwork.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 118412 INFO: Loading module hook 'hook-PyQt5.QtOpenGL.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 118881 INFO: Loading module hook 'hook-PyQt5.QtPositioning.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 119041 INFO: Loading module hook 'hook-PyQt5.QtPrintSupport.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 119527 INFO: Loading module hook 'hook-PyQt5.QtQml.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 120197 INFO: Loading module hook 'hook-PyQt5.QtQuick.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 120714 INFO: Loading module hook 'hook-PyQt5.QtQuickWidgets.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 121280 INFO: Loading module hook 'hook-PyQt5.QtSensors.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 121440 INFO: Loading module hook 'hook-PyQt5.QtSerialPort.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 121595 INFO: Loading module hook 'hook-PyQt5.QtSql.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 122097 INFO: Loading module hook 'hook-PyQt5.QtSvg.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 122613 INFO: Loading module hook 'hook-PyQt5.QtTest.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 123105 INFO: Loading module hook 'hook-PyQt5.QtWidgets.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 123623 INFO: Loading module hook 'hook-PyQt5.QtXml.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 123776 INFO: Loading module hook 'hook-PySide2.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 124800 INFO: Loading module hook 'hook-PySide2.QtCore.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 124905 INFO: Loading module hook 'hook-PySide2.QtGui.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 125256 INFO: Loading module hook 'hook-PySide2.QtNetwork.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 126365 INFO: Loading module hook 'hook-PySide2.QtPrintSupport.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 126855 INFO: Loading module hook 'hook-PySide2.QtWebEngineWidgets.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 127855 INFO: Loading module hook 'hook-PySide2.QtWidgets.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128375 INFO: Loading module hook 'hook-pytz.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128678 INFO: Loading module hook 'hook-scipy.linalg.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128678 INFO: Loading module hook 'hook-scipy.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128685 INFO: Loading module hook 'hook-scipy.sparse.csgraph.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128687 INFO: Loading module hook 'hook-scipy.spatial.transform.rotation.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128761 INFO: Loading module hook 'hook-scipy.special._ellip_harm_2.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128761 INFO: Loading module hook 'hook-scipy.special._ufuncs.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128762 INFO: Loading module hook 'hook-scipy.stats._stats.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 128763 INFO: Loading module hook 'hook-setuptools.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 130384 INFO: Loading module hook 'hook-shelve.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 130391 INFO: Loading module hook 'hook-sqlalchemy.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 131337 WARNING: Hidden import "pysqlite2" not found! 131339 WARNING: Hidden import "MySQLdb" not found! 131340 WARNING: Hidden import "psycopg2" not found! 133423 INFO: Loading module hook 'hook-sqlite3.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133511 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133511 INFO: Loading module hook 'hook-win32ctypes.core.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133717 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133718 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133718 INFO: Loading module hook 'hook-xml.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133719 INFO: Loading module hook 'hook-zope.interface.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133727 INFO: Loading module hook 'hook-_tkinter.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 133876 INFO: checking Tree 133876 INFO: Building Tree because Tree-00.toc is non existent 133876 INFO: Building Tree Tree-00.toc 133965 INFO: checking Tree 133965 INFO: Building Tree because Tree-01.toc is non existent 133965 INFO: Building Tree Tree-01.toc 134053 INFO: checking Tree 134053 INFO: Building Tree because Tree-02.toc is non existent 134053 INFO: Building Tree Tree-02.toc 134057 INFO: Loading module hook 'hook-lxml.isoschematron.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 134067 INFO: Loading module hook 'hook-lxml.objectify.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 134067 INFO: Loading module hook 'hook-platformdirs.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\stdhooks'... 134068 INFO: Loading module hook 'hook-PySide2.QtPositioning.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 134208 INFO: Loading module hook 'hook-PySide2.QtQuick.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 134712 INFO: Loading module hook 'hook-PySide2.QtQuickWidgets.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 135283 INFO: Loading module hook 'hook-setuptools.msvc.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 135293 INFO: Loading module hook 'hook-PySide2.QtQml.py' from 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks'... 136005 INFO: Looking for ctypes DLLs 136250 WARNING: Library wintab32.dll required via ctypes not found 136361 INFO: Analyzing run-time hooks ... 136382 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_inspect.py' 136383 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_subprocess.py' 136384 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pyside2webengine.py' 136385 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pyside2.py' 136386 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgres.py' 136390 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py' 136392 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_multiprocessing.py' 136393 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32api.py' 136394 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_win32comgenpy.py' 136395 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\rthooks\pyi_rth_pywintypes.py' 136396 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\_pyinstaller_hooks_contrib\hooks\rthooks\pyi_rth_pythoncom.py' 136397 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth__tkinter.py' 136398 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_mplconfig.py' 136399 INFO: Including run-time hook 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pyqt5.py' 136448 INFO: Looking for dynamic libraries 138372 WARNING: lib not found: LIBPQ.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyQt5\Qt5\plugins\sqldrivers\qsqlpsql.dll 140962 WARNING: lib not found: hdf5-a241c97c.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables_comp_bzip2.cp38-win_amd64.pyd 140966 WARNING: lib not found: libbz2-e4ba6a29.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables_comp_bzip2.cp38-win_amd64.pyd 140970 WARNING: lib not found: hdf5-a241c97c.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables_comp_lzo.cp38-win_amd64.pyd 140978 WARNING: lib not found: hdf5-a241c97c.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\indexesextension.cp38-win_amd64.pyd 140984 WARNING: lib not found: hdf5-a241c97c.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\tableextension.cp38-win_amd64.pyd 140988 WARNING: lib not found: blosc-965398da.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\tableextension.cp38-win_amd64.pyd 140992 WARNING: lib not found: hdf5-a241c97c.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\linkextension.cp38-win_amd64.pyd 140997 WARNING: lib not found: hdf5-a241c97c.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\hdf5extension.cp38-win_amd64.pyd 141001 WARNING: lib not found: blosc-965398da.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\hdf5extension.cp38-win_amd64.pyd 141005 WARNING: lib not found: hdf5-a241c97c.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\utilsextension.cp38-win_amd64.pyd 141008 WARNING: lib not found: blosc-965398da.dll dependency of C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\tables\utilsextension.cp38-win_amd64.pyd 142174 INFO: Looking for eggs 142174 INFO: Using Python library C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python38.dll 142174 INFO: Found binding redirects: [] 142201 INFO: Warnings written to E:\mechanical-calculation-4\程序文件\齿轮几何计算\build\chilun\warn-chilun.txt 142695 INFO: Graph cross-reference written to E:\mechanical-calculation-4\程序文件\齿轮几何计算\build\chilun\xref-chilun.html 142915 INFO: checking PYZ 142915 INFO: Building PYZ because PYZ-00.toc is non existent 142915 INFO: Building PYZ (ZlibArchive) E:\mechanical-calculation-4\程序文件\齿轮几何计算\build\chilun\PYZ-00.pyz 149341 INFO: Building PYZ (ZlibArchive) E:\mechanical-calculation-4\程序文件\齿轮几何计算\build\chilun\PYZ-00.pyz completed successfully. 149431 INFO: checking PKG 149431 INFO: Building PKG because PKG-00.toc is non existent 149431 INFO: Building PKG (CArchive) chilun.pkg 153455 WARNING: One binary added with two internal names. 153456 WARNING: ('arrow.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow.dll', 'BINARY') 153456 WARNING: was placed previously at 153456 WARNING: ('pyarrow\arrow.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow.dll', 'BINARY') 153492 WARNING: One binary added with two internal names. 153493 WARNING: ('arrow_dataset.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow_dataset.dll', 'BINARY') 153493 WARNING: was placed previously at 153493 WARNING: ('pyarrow\arrow_dataset.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow_dataset.dll', 'BINARY') 153596 WARNING: One binary added with two internal names. 153597 WARNING: ('parquet.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\parquet.dll', 'BINARY') 153597 WARNING: was placed previously at 153597 WARNING: ('pyarrow\parquet.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\parquet.dll', 'BINARY') 153702 WARNING: One binary added with two internal names. 153702 WARNING: ('arrow_python.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow_python.dll', 'BINARY') 153702 WARNING: was placed previously at 153703 WARNING: ('pyarrow\arrow_python.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow_python.dll', 'BINARY') 153708 WARNING: One binary added with two internal names. 153709 WARNING: ('arrow_flight.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow_flight.dll', 'BINARY') 153709 WARNING: was placed previously at 153709 WARNING: ('pyarrow\arrow_flight.dll', 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\pyarrow\arrow_flight.dll', 'BINARY') 217623 INFO: Building PKG (CArchive) chilun.pkg completed successfully. 217733 INFO: Bootloader C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe 217733 INFO: checking EXE 217734 INFO: Building EXE because EXE-00.toc is non existent 217734 INFO: Building EXE from EXE-00.toc 217734 INFO: Copying bootloader EXE to E:\mechanical-calculation-4\程序文件\齿轮几何计算\dist\chilun.exe.notanexecutable 217738 INFO: Copying icon to EXE 217738 INFO: Copying icons from ['C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\PyInstaller\bootloader\images\icon-console.ico'] 217738 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes 217738 INFO: Writing RT_ICON 1 resource with 3752 bytes 217738 INFO: Writing RT_ICON 2 resource with 2216 bytes 217738 INFO: Writing RT_ICON 3 resource with 1384 bytes 217738 INFO: Writing RT_ICON 4 resource with 37019 bytes 217739 INFO: Writing RT_ICON 5 resource with 9640 bytes 217739 INFO: Writing RT_ICON 6 resource with 4264 bytes 217739 INFO: Writing RT_ICON 7 resource with 1128 bytes 217740 INFO: Copying 0 resources to EXE 217740 INFO: Emedding manifest in EXE 217741 INFO: Updating manifest in E:\mechanical-calculation-4\程序文件\齿轮几何计算\dist\chilun.exe.notanexecutable 217741 INFO: Updating resource type 24 name 1 language 0 217743 INFO: Appending PKG archive to EXE 269754 INFO: Building EXE from EXE-00.toc completed successfully.

Julio-Cesar7 commented 7 months ago

Gracias por los consejos que dieron anteriormente. He tenido el mismo problema y he leído a cada uno de las respuestas, dando resultados muy favorables: