-
Notifications
You must be signed in to change notification settings - Fork 13.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Freeze your script with Pyinstaller #357
Comments
Cool, thanks for sharing! |
I found this worked very well when running on Windows desktop, but the application would crash on Windows Server 2012 - 2016 with an unhelpful, vague unable to execute DLL error. I found this issue was caused by using the latest version of dlib linked in the project install guide under issue 175 (currently 19.9.99). However, by using 'pip install dlib', which installs 19.9.0 (again, currently as of writing this). The frozen executable is running without errors on both desktop and server. I've also been testing freezing this in both 32-bit and 64-bit python and both are working. Thanks |
@vgreis I haven't tested Pyinstaller with the new version of |
Thanks! It works |
Incompatible library version: dlib.so requires version 51.0.0 or later, but libpng16.16.dylib provides version 38.0.0 |
@inewlife Can you post the complete error log? I haven't tested this method with the new version of |
I did as what the first floor told,but still got this: how did the exe file come to this dir ? when i use nuitka to make exe file ,and it jumped out this as the exe file run : thanks |
@fordffx Hi, |
i replaced |
thanks for sharing your knowledge...i can't find scipy-extra-dll ...how i can to find them in python directory??i am in ubuntu 16.04, |
@roiksail Hi, dll files are not made for Linux systems so you can't find any. I think you don't need to add |
thank you,how i change myscript.spec file??
…On Tue, Apr 10, 2018 at 10:19 PM, Masoud R. ***@***.***> wrote:
@roiksail <https://github.com/roiksail> Hi, dll files are not made for
Linux systems so you can't find any. I think you don't need to add scipy
dependencies. Just build your binary file and try to run it. If It
complains about some files just find that and add it manually like above
method. That is it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#357 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Ahjqp8SBtcZj6ua74UNX5VENf0B4MbY4ks5tnPCdgaJpZM4SBU9b>
.
|
@roiksail First you need to freeze your script with |
thank you so much,i mmaked executable application in ubuntu but when i copied this file in ubuntu then it was simply file and it does not executed,how i fix this?? |
@roiksail I think you need to find out what is Pyinstaller and how to use it in from here. In general, after you run the command you should find the executable with the exact name of the script. I think |
@vgreis thanks, when I build use dlib from github source code, The version is 19.10.99, It can only run on x64 system, and when I use |
I'm not find 1, when I am not install scipy, I can run face_recognition, Is scipy necessary? thank you |
@sincerefly Hi, If I remember correctly there are some examples that need |
@sincerefly @masoudr Confirmed. My app works with Also, for now Thanks for your efforts! -- |
@masoudr Can you please explain to me how can I get the face_recognition_models/**/*.dat resources added from the .spec file? It does not seem to work for me. It says unable to open shape_predictor_68_face_landmarks.dat for some reason. So far, I have tried:
|
@tinshade I've already added all 4 model files in the example above, you just need to use the above sample spec file and fill parameters and this should solve your problem. But if you still need to add other models you can just add this to your spec file.
|
This comment has been minimized.
This comment has been minimized.
@alexpardede I'm not familiar with |
This comment has been minimized.
This comment has been minimized.
sorry to bother you.I don't understand.is 19.9.0dlib installed in the computer which pyinstaller the file or in winserver2012?My my application can run in my windows computer,but it can't work on my windows server2012.And my dlib package can't be uninstalled completely now.... |
maybe you could try building the latest version of dlib on the target platform |
I can't find the scipy-extra-dll in windows although I installed scipy. Help me. |
@Ragesh77 I haven't tested the new version. But check if you can import |
@masoudr Thanks for answering. I downgraded scipy to 1.3.0 and could locate all the files. |
You can search extra-dll using below code on cmd |
Thanks for everything all guys. I did what you said and I created an exe file successfully. But when I click exe file it's working only once then suddenly closes. Before close it says something but I don't read because it is so fastly close. How can I fix this problem |
@HAKANMAZI Try to run executable with CMD and you should get the error in the console. Then put the error. |
Can Someone help me in deploying this app in docker.I searched google nothing is clear.Could someone guide me? |
@Ragesh77 It is not an app. But if you trying to deploy your app with docker you can follow this. |
Thanks @masoudr ; output error below, error says me No module named 'sklearn'. Yes true there is no sklearn because I don't use it. Even if when I run my .py file there is no error. But when I change from .py to .exe file it saying No module named 'sklearn'. Why ?
|
@HAKANMAZI Your error is not related to this tutorial (because you are using |
Finally I solved my problem. |
hello I am new to this freezer part, I have made a separate folder as mentioned and move my python script and models in it. |
@daynial132 First make sure that your script is working fine in your environment also you must be sure that you run PyInstaller from your environment (with using |
@masoudr I have placed my python script,3 pics and the freezer file (.spec) and the face_recognition_models in the folder only. do I need any thing else? I have check my python script to run on my anaconda shell, it is running fine that's mean dlib and face_recognition lib is installed properly. Am i right or missing some thing? Also I have used anaconda shell to run (python -m PyInstaller) command. Thank you for your reply |
@daynial132 I haven't tested this with Conda yet, but I don't think it would be a problem. Your error means that PyInstaller can't find the |
I am having this output after freezing my code with this
|
@mend4x Make sure that you have the |
@masoudr I actually do have this file in script directory. The given path is |
@mend4x Double check that the files in |
@masoudr 我的问题是,打包的时候没有问题,打包后,点击exe 只有小黑窗口,程序没办法运行。 |
窗口提示: |
Thank you sooooooooooooooooooooooooooooooooo much! :) |
THANK YOU SO MUCH BRO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
Error loading Python DLL 'C:\Users\91880\Desktop\application\python310.dll'. getting this error please help. |
@divyangana009 This is a basic error that I think might be related to PyInstaller itself. Have you tried freezing a simple script, I mean without |
I've tried out what you suggested and my program runs with no errors in VSC but every time I convert it to .exe it simply runs so quickly that the terminal pops up so quick and close. I tried executing the exe file in Anaconda prompt and still giving me this error: SyntaxError: Non-UTF-8 code starting with '\x90' in file C:\Users\PC\Desktop\VSworkSpace\FaceRecProject\dist\main\main.exe on line 1, but no encoding declared; see https://python.org/dev/peps/pep-0263/ for details Even though I've added # -- coding: utf-8 -- at the first line of my code Please help me solving this issue |
@SAUDIANO I'm not sure what is the cause of the problem, but first, make sure that you run your executable directly from a standard CMD and not python this. Second, create a clean virtual environment with Conda and generate the executable in that env. Moreover, try to update the Pyinstaller to the latest version. |
i use ultralytics then how to use |
Hi,
You might want to freeze your script into a standalone executable to run on any system without the need of installing
python
orface_recognition
and maybe you want to create a demo for your application and want to give it to someone else without giving your source code. Here is a simple tutorial to do that. I tested this method withpython3.6
on Windows 10, but I think you can get it working on Linux with a similar method.face_recognition
anddlib
and you see no error when importing them into your script.python yourscript.py
.pip
:pip install pyinstaller
myproject
andmyscript.py
face_recognition_models
andscipy-extra-dll
from your python installed directory to your project directory.<yourscriptname>.spec
likemyscript.spec
next to your python script.<>
tag)python -m pyinstaller myscript.spec
dist
directory.Thanks to @ageitgey and @davisking for their awesome work.
The text was updated successfully, but these errors were encountered: