I am trying to compile a program to an .exe to be distributed among several computers at work. I need it to be one file, so I've used the --onefile option in Pyinstaller. Well, the program has several files that it is dependent on, so I've used the --add-data option for each of those files, and it seems to work. If i compile it with the --onedir option everything works perfectly, but if i change to --onefile, thats when it breaks. I get an error saying (the additional files) could not be found.
I've done plenty of research on the forums and the Pyinstaller manual and looked into the MEI**** folder. It looks like my additional files are being correctly loaded into the folder at runtime, but I don't really understand how that is useful, because The .exe would only be looking in its working directory for the files. I tried using the --runtime-tmpdir option to point at a folder i can run the .exe from, but it still creates the MEI***** folder, which is randomly named, so that doesn't help. Here is the command i am running in the terminal. I also tried changing the .spec file and running Pyinstaller with that, and I had the exact same problem.
pyinstaller.exe ^
--onefile ^
--runtime-tmpdir
"C:\\Users\\MyUser\\PycharmProjects\\helloworld\\TempRuntime" ^
--add-data="DI1.npy;." ^
--add-data="DI2.npy;." ^
--add-data="DI3.npy;." ^
--add-data="DI4.npy;." ^
--add-data="DI5.npy;." ^
--add-data="DI6.npy;." ^
--add-data="OwnerPredict2.joblib;." ^
connectToOracle.py
(EDIT) And here is the portion of the code that actually needs those files. using numpy load and converting to a pandas dataframe.
TestFrame.fillna(0, inplace=True)
print('Copying Dataframe')
TestFrameFinal = TestFrame.copy(deep=True)
DI1 = load('DI1.npy', allow_pickle = True).item()
DI2 = load('DI2.npy', allow_pickle = True).item()
DI3 = load('DI3.npy', allow_pickle = True).item()
DI4 = load('DI4.npy', allow_pickle = True).item()
DI5 = load('DI5.npy', allow_pickle = True).item()
DI6 = load('DI6.npy', allow_pickle = True).item()
model = jl('OwnerPredict2.joblib')
I would like to be able to compile all of this into one .exe, no matter how large or slow, that can be executed on any pc at my work by anybody. I need to get these extra files to be unpacked into a location that the .exe can find so everything will run properly.