0

I'm working on my first gui exe. I'm using the anaconda packages with spyder and the code works fine there. Math, pyplot, numpy, tkinter, and PIL are imported, and the app is fully functional with the exception of pyplot which will not show up when activated from a button widget.

If instead I create a simple exe with the code:

import numpy
import matplotlib.pyplot as plt
x=numpy.linspace(1,100)
fig,ax=plt.subplots()
lineData,=ax.plot(x,3*x)

I get one error during the initial build:

ModuleNotFoundError: No module named 'Crypto.Math'

and many warnings, but note that the analysis warning file contains no errors either.

Running the created exe, I get failure and cmd exits. Running from cmd initially instead and turning on debug and verbose imports yields tons of warnings, but no errors.

I've tried including hidden imports like 'matplotlib.pyplot','matplotlib','Crypto', and importing Crypto, to no avail. Crypto is not being called anywhere and the reference plot in the build folder says only pyinstaller imports it. I'm at a loss here for what the problem could be.

Packages in anaconda folder

Community
  • 1
  • 1
dasdude
  • 1
  • 3
  • Have you included the Crypto library? Take a look at [this](https://stackoverflow.com/questions/19623267/importerror-no-module-named-crypto-cipher) – Pirate X Aug 19 '19 at 17:19
  • I believe so. Crypto imports in spyder. I added an image showing Crypto libraries I have in Anaconda and the redundancy of the names seems odd. I went through the link you posted beforehand and honestly I didn't troubleshoot with it since there seemed to be 10 different somewhat conflicting answers, but I suppose I'll need to go through the ringer and see if any of it works. I'll update accordingly once I've tried them. – dasdude Aug 19 '19 at 17:53

1 Answers1

0

Ok, so it turned out to be a simple fix. lineData,=ax.plot(x,3*x) will plot/show the figure in spyder/Ipython, but not when called in the exe or python standalone, so I had to add plt.show().

From there I made a virtual environment with the latest packages and needed to downgrade numpy to 1.16.2 per this thread, and now everything works.

dasdude
  • 1
  • 3