Version: Python 3.7 (Spyder) -- OS: Windows10 -- System: Core i5 (6th gen) + 16gb RAM
I wrote a program which handles a lot of data. The following structure is used to accomplish this:
Program Description
- A GUI interface is used as a main function (class). In here an interface pops up, asks the user for input, uses this input the make all kinds of calculation, which are specified in different functions.
- The first function is an import function, where in a specified (by user) folder is searched for all .wav files and where the data of these are imported. All imported items are appended (numpy.append) to one big array.
- The big array (for 20 files about 2.000.000.000 datapoints) is used to calculated characteristics of the sound file. The reason it has so many datapoints is because the samplerate of the .wav file is set on 78125 samples/s, which I need for accurate calculations.
- After the calculations, 2 plots are generated in a specified folder and 2 csv's are also stored in that folder with the requested data.
Problem Statement
Running the main function (program) in the spyder environment, works totally fine. It take about 10 minutes to go through all the data and generates the output.
Compiling the function to an .exe using PyInstaller, works fine, no errors, everything dependency imported. However when running the program a MemoryError pops up almost immediatly (see image below).
Image: error message from command line when executing the exe file
Tried solutions
Running the python script via CLI, gives the same error
Running the .exe program with only 2 files to import, works all file, but incredibly slow (much slower than executed via spyder)
Questions
- Why has spyder enough memory to process all data with no problems, but when executing the .py via command line or when executing the .exe file, there is always a memory error?
- Why does the .exe or the .py via CL run slower than in the spyder IDE?
Goal
This program should be able to process noise data on every laptop in the company (also 8gb ram sometimes). So I want to find a way to let the program allocate all available RAM on the used machine.
Thanks in advance, for any help!