Missing .dll files in an executable kivy application (matplotlib) - python

I created a kivy application that allows plotting some graphics by using matplotlib lib. it worked well, and than i converted it to .exe with cx_freeze, it displayed this error :
Intel MKL FATAL ERROR : Cannot load mkl_intel_thread.dll.
After hours in forums, i putted all the mkl .dll files that exists in the Anaconda3-Windows-x86_64\\Library\bin in Anaconda3-Windows-x86_64\Lib\site-packages\numpy\core folder because matplotlib needs numpy. with this action, the executable works perfectly on my laptop but not for the other users's laptops, it displayed this error :
System Error
The program can't start because mkl_core.dll is missing from your computer. Try reinstalling the
program to fix this problem.
And then i putted the dll files in some folders in the executable's lib folder and now it displays this error :
System Error
The program can't start because libiomp5md.dll is missing from your computer. Try reinstalling the
program to fix this problem
I don't understand whey these errors and how to solve this issue. I know that there is no error in my scripts (myapp.py and setup.py ) because it works well in my laptop.
Have you any idea please ?
Thank you

I am wondering if you properly assigned access permissions to the files. If you put them manually they may get your user's permissions and hence appear to be missing (inaccessible) for any other user.

Related

Error loading python37 dll on Windows 7 after Pyinstaller created exe

I created an exe file using PyInstaller and it works on my PC with Windows 8.1 and laptop with Windows 10, but on computers with Windows 7 it has error
"error loading python37 dll "
and something about dynamic linked libraries.
EDIT:
Error loading Python DLL 'C:\Users\Dell\Appdata\Local|Temp|_MEI16442\python37.dll'. LoadLibrary: Procedure of initialize dynamic linked library (DLL) failed.
It is translated from Polish
Do you know maybe how can I fix it?
I was reading about static linked dll but I dont know how to do it. I am working on Windows only, I dont know Linux/Mac.
This used to happen to me all the time, and it was always because I tried to run the executable file from the build folder while the one that works is in the dist folder.
I had this same issue while compiling the executable with a Pyinstaller command. To fix it, I added the --noupx option and everything worked fine.

Why can't I make a .exe with anything using pandas anymore?

So, I used to use auto-py-to-exe to create exe files. This worked great a week ago. I created a few scripts that used pandas and some other libraries. Now when I try to make something and double click the file it just opens cmd and then shuts down immediately. I even just tried making a simple hello world script that just imported pandas, printed hello, then asked for an input to pause the program. If I do that without importing pandas, the .exe works fine. If I put import pandas into the script, then the .exe will fail.
Nothing fails when I run it through spyder or anything. It just fails when I put make it an executable file.
I have uninstalled auto-py-to-exe and reinstalled it. Uninstalled pyinstaller and reinstalled. I tried completely uninstalling anaconda and libraries and reinstalling. I tried using cx_Freeze. All have the same results.
I tried using the advice here build python script to single exe with pyinstaller. Same result.
Anyone have a solution to this? I don't know why it is suddenly not working.
Also, I am a pretty noob developer here, so I imagine I am just messing something simple up, but I can't figure it out.
example of my simple script:
import pandas as pd
print('hello world')
pause = input('hit enter to end')
also if I run the program in cmd I get this error -
INTEL MKL ERROR: The specified module could not be found. mkl_intel_thread.dll.
Intel MKL FATAL ERROR: Cannot load mkl_intel_thread.dll.
So, the problem was that pyinstaller wasn't finding my libraries. The solution was to create a virtual environment and launch from there. I used this setup as a guide. https://medium.com/#liron92/pyinstaller-with-pandas-problems-solutions-and-workflow-with-code-examples-c72973e1e23f Basically just create a virtual environment, pip install all the libraries you need, then launch auto-py-to-exe or pyinstaller from that environment. Problem solved.

Changing QT_PLUGIN_PATH in environment variables causes programs to fail

I am using anaconda 3 and when I turn python scripts to .exe using pyinstaller they failed to open and I got an error message that said,
Application can't start because could not find or load Qt platform plugin "windows" in " "
I looked on stack overflow and found a solution for it here, and it solved my problem. However, now when I download other programs from the internet and try to open them they display the same error,
Application can't start because could not find or load Qt platform plugin "windows" in " "
I have delete the QT_PLUGIN_PATH from the environment variables in order to make the program that I installed work, but when I do that my .exe fails to open and I have to add the QT_PLUGIN_PATH again to make the .exe work.
Is there a way to make both my .exe and installed programs work without having to add and delete the QT_PLUGIN_PATH from the environment variables every time?
In environment variables I have,
QT_PLUGIN_PATH="C:\Users\username\AppData\Local\Continuum\anaconda3\Library\plugins"
I found a solution to my problem. I found that deleting the QT_PLUGIN_PATH from the environment variables and adding the platforms folder in my .exe folder fixes the problem. In my case, I am using anaconda 3, so I deleted QT_PLUGIN_PATH from the environment variables and then I copied the platforms folder from this directory, C:\Users\username\AppData\Local\Continuum\anaconda3\Library\plugins\platforms and pasted it to the same folder where my .exe is, which is in my desktop. Doing this fixed all my issues. I hope my solution helps you.

Pyinstaller - Standalone .exe

I am trying to create an .exe file such that when run on any windows 10 pc will run without requiring any installations. What I tried using was:
pyinstaller --onefile main.py
I ran the exe file on a friend's computer and it turns out that it required first python2.7 to be installed, then it said that modules weren't installed i.e; no module named datetime found. The executable finally ran after I installed all dependencies on my friend's computer but the whole point of creating .exe file was useless, I might as well have just typed python main.py after doing so much. Is there an appropriate way I could get an .exe file from .py which wont require anything to be installed? Like an actual standalone app. Thank you!
Actually this should work. I never had problems with pyinstaller, yet. Maybe reinstall pyinstaller or make sure to use the newest version. Also try first of all an easy "helloWorld"
input("hello from Console.\nPress Enter to close it :)")
Just tried this one on a colleague's machine that has no python installed. And it worked well.
I've had good results using the pyinstaller module to one file even when running code with multiple dependencies on machines without python installed. Reading the documentation helped There is a comprehensive list of python to exe compilers in another stackoverflow question: a good python to exe compiler?

Windows services with Python and py2exe

I need some help with converting a python windows service using py2exe.
Let me explain the problem. I have a python service, which works, no problems here. I used py2exe to turn it into an executable file. I tested it by replacing the python version of the service with this one and it works with no problems too.
But when I move the exe version of the service to another computer, it will register with the service manager but won't start with the error: "The system cannot find the file specified". The missing file is one of the modules I've written.
I played with this a bit and went back to the machine where I used py2exe and where the exe version of the service works. I removed everything python related, everything py2exe created but the "dist" folder, everything I could think of that was related with the python version of the service. The exe version still worked (altho I removed, amongst others, the very files that were supposedly missing on the other machine).
Tried a bunch of different things but cant get the exe version to work. If any of you guys have any ideas, I'd really appreciate it.
P.S: I do have the c++ runtime installed on the target machine. You can't register the service without it and as I said, I can register it, it just won't run.
Even if you converted the .py script to an exe, the service still uses the python interpreter to run the service code itself. if you open "Services" and look at the service properties you should see something like -
Path to executable:
"C:\Python27\lib\site-packages\win32\PythonService.exe"
i'm guessing the other computer doesnt have python installed on it.
if you want to be able to run that service on a machine without installing python you need to do something like This
,or you can also do it using cx_freeze
http://www.py2exe.org/index.cgi/py2exeAndWindowsServices
There are some notes in there about modules conflicting with windows system dlls. He had a problem because he had a module called version and import version caused the app to error out.
You can try importing win32traceutil as the first thing in your service. This should allow you to run the win32traceutil console app to display any stdout/stderr output from the service.

Categories

Resources