Using pyinstaller on parmap causes a tkinter matplotlib import error. Why?
NickName:Frikster Ask DateTime:2016-08-25T09:38:38

Using pyinstaller on parmap causes a tkinter matplotlib import error. Why?

Update

If I try downgrading from Pyinstaller 3.2 to 3.1 I instead get the following traceback when I try to run the executable.

enter image description here

I tried adding --hidden-import=collect_submodules('pkg_resources._vendor') to pyinstaller as noted here but it had no effect. Same error. This appears to be due to an issue with setuptools. I'm using 26.0.0. Downgrading to 19.3 that many sources say fixes the issue does indeed fix this issue but then I'm back to the issue I have below.


I have a python 2.7 pyqt4 project I'm trying to turn into an .exe using pyinstaller. I use:

pyinstaller --additional-hooks-rir=. --clean --win-private-assemblies pipegui.py

pipegui.py can be found on github here

I get a working executable and the app appears functional. Here is what the terminal spits while pyinstaller is freezing. However the app crashes when I run particular parts of my program. It crashes and the terminal goes in a loop continually outputting the same traceback below with "Poolworker-X" at the very top continually incrementing:

enter image description here

As you can see tkinter is implicated, despite the word "tkinter" appearing nowhere in my project (using pyqt4). I am making use of matplotlib though and from answers discussed here and here I have added the following to the top of pipegui.py my main script:

    from Tkinter import * 
    import Tkinter
    import FileDialog

This however seems to be a step in the wrong direction because after freezing with this (and the same flags as before) my executable wont even open and instead I get this:

enter image description here

Here is pyinstaller's pretty-much identical output while freezeing. Remember all I did was add those 3 import statements above. That's it.

I also tried pyinstaller --additional-hooks=. --clean --win-private-assemblies --hidden-import=Tkinter pipegui.py and it made no difference. I'm completely perplexed as to why trying to import tkinter is doing this. Will fixing this traceback lead me closer to solving the other?

I only figured out after trying all this that the only parts of my executable that are crashing are parts that make use of parmap multiprocessing. Classes that make use of matplotlib but not parmap are working fine.

So please note my question is how the first traceback can be fixed and also why are both matplotlib and tkinter popping up in the traceback despite my code where the crash occurs making use of niether?

Extra notes

  • I use --clean --win-private-assemblies to fix error code 14001 as per here

Copyright Notice:Content Author:「Frikster」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/39135408/using-pyinstaller-on-parmap-causes-a-tkinter-matplotlib-import-error-why

More about “Using pyinstaller on parmap causes a tkinter matplotlib import error. Why?” related questions

Using pyinstaller on parmap causes a tkinter matplotlib import error. Why?

Update If I try downgrading from Pyinstaller 3.2 to 3.1 I instead get the following traceback when I try to run the executable. I tried adding --hidden-import=collect_submodules('pkg_resources._v...

Show Detail

Why is pyInstaller trying to import tkinter?

My pyInstaller build is trying to install tkinter, which is causing all kinds of problems. I can work around them, but the real question is why is it trying to import tkinter at all? I'm using wx! ...

Show Detail

pyinstaller wont work with tkinter and matplotlib

I have anaconda, python 3. I started cmd.exe from Anaconda and run the code: pyinstaller --onefile guitest4.py. Lots of errors get reported, exe gets built, the exe starts the cmd window and closes

Show Detail

Pyinstaller with Tkinter Matplotlib numpy scipy

I am using Pyinstaller (after spending a long time with py2exe) to convert my REAL.py file to .exe. I used Anaconda to make .py file which is running perfectly on my computer. But when I make .exe...

Show Detail

pyinstaller: building a python exe using matplotlib

I have been trying to replicate the example of this post, to generate an executable with pyinstaller but with no success. I am on a linux OS. the exe I try to build is based on this code (test.py

Show Detail

exe made by pyinstaller crashes at calling matplotlib

I am trying to use matplotlib with Tkinter to create a stand-alone executable by pyinstall (command: pyinstaller --onefile main.py). The program works at the stations where the python installed. Ho...

Show Detail

import error for ibm_db using PyInstaller

How I can fix the bellow error? I have a python code using GUI (tkinter) to get value and use the value to get data from ibm DB. however, when I wanted to change it from py to exe using pyinstalle...

Show Detail

[Pyinstaller]: Working code produces ModuleNotFoundError when turned to exe

Working with Pyinstaller 3.5 and python 3.6 (installed with Anaconda). I have a python code that explicitly imports numpy and works fine when launched with Spyder or the Anaconda prompt. Using

Show Detail

PyInstaller: "No module named Tkinter"

I've built a Python (2.7) app that uses Tkinter and am trying to build a Windows7 .exe using Pyinstaller (3.2). The app works find in windows is I run it as python myapp.py, but once compiled into a

Show Detail

Creating Python Tkinter exe file with Pyinstaller problem

I have created GUI python2.7 program with Tkinter successfully without error. Now I want to make an executable file of it using pyinstaller in anaconda environment (I'm using windows 10). Using t...

Show Detail