Quantcast
Channel: Active questions tagged crash - Stack Overflow
Viewing all articles
Browse latest Browse all 7199

Problem with Pyinstaller and Matplotlib. File .exe doesn't work and not give any error

$
0
0

I'm pretty new with Python and program language in general.

I haven't made any progress on this for over a week so finally I tried to ask here (My first time!).

As many others (I have searched everywhere but could not find anything that can help me), I m trying to suceed to have an exe. file from Python script (with the matplotlib module inside) using Pyinstaller.

The problems of course happen when double-click on exe file (with anaconda or python compiler I don't have any problem)

I understand that the problem is relating to matplolib and its relating row (if I comment them the exe file works well)

I tried many things like, downgrade matplotlib, pyinstaller, using different computer and version of python, using different type to have a plot, but none of this worked.

The following is a simple example of script that doesn't work `

import matplotlibfrom matplotlib.figure import Figureimport numpy as npt = np.arange(0.0, 2.0, 0.01)s = 1 + np.sin(2 * np.pi * t)fig= Figure()ax = fig.add_subplot(111)ax.plot(t, s)ax.set(xlabel='time (s)', ylabel='voltage (mV)',       title='About as simple as it gets, folks')ax.grid()fig.savefig("test.png")`enter code here`

I detected that the problem start at the first matplotlib comand in the previous case "fig= Figure()", but other times was "fig, ax = plt.subplots()" or "plt.show() (of course there was import matplotli.pyplot as plt)"

Another problem is that when double-click on .exe after some time the window close without any clear error message.

Running pyinstaller with --debug=all the last rows before crash are the following enter image description here

so it stops at import matplotlib.pyplot (In the script attached befor it stops at import matplotlib.figure). I also add these import to hidden import by --hidden-import=matplotlib.pyplot but doesn't change nothing.

Someone has some advices? PLeas help me to achieve this problem :)

pyinstaller version 4.2python 3.8.5 / 3.7 / 3.9.4matplotlib 3.1.3 (downgrade from 3.4.1)

Win10

Many Thanks in advice,

Stefano


Viewing all articles
Browse latest Browse all 7199

Trending Articles