face_recognition
face_recognition copied to clipboard
PyInstaller + face_recognition Exe Runtime Error
- Python version: 3.6
- Operating System: Ubuntu 18.04
Description
I was trying to execute an exe file I had made using PyInstaller that utilized the face_recognition library. Unfortunately when executing the file, I got a Runtime Error. I saw a similar error (#628) which told me to install the models but after runningpip install face_recognition_models
and remaking the exe, I am still getting this error.
Error:
RuntimeError: Unable to open /tmp/_MEIJebbbx/face_recognition_models/models/shape_predictor_68_face_landmarks.dat
Full Error Message:
Traceback (most recent call last):
File "Interface.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "/home/samrat/Documents/Facial-Recognition-Attendance-Tracker/venv/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "Camera.py", line 5, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "/home/samrat/Documents/Facial-Recognition-Attendance-Tracker/venv/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "face_recognition/__init__.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "/home/samrat/Documents/Facial-Recognition-Attendance-Tracker/venv/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "face_recognition/api.py", line 20, in <module>
RuntimeError: Unable to open /tmp/_MEI4LEO3U/face_recognition_models/models/shape_predictor_68_face_landmarks.dat
[9073] Failed to execute script Interface
Any and all insight is appreciated. Thanks!
It is just - pip install face_recognition. I think.
It is just - pip install face_recognition. I think.
In order to install the face_recognition library (which I have already done) you need pip install face_recognition
However, the error message says it cannot open face_recognition_models and so I pip installed the models as well but it is still throwing the error
I have this problem, too 。 help!datas=[('shape_predictor_68_face_landmarks.dat','./face_recognition_models/models'),('shape_predictor_5_face_landmarks.dat','./face_recognition_models/models'),('mmod_human_face_detector.dat','./face_recognition_models/models'),('dlib_face_recognition_resnet_model_v1.dat','./face_recognition_models/models')],
i use this,that is run
Can you fix that?
- Python version: 3.6
- Operating System: Ubuntu 18.04
Description
I was trying to execute an exe file I had made using PyInstaller that utilized the face_recognition library. Unfortunately when executing the file, I got a Runtime Error. I saw a similar error (#628) which told me to install the models but after running
pip install face_recognition_models
and remaking the exe, I am still getting this error.Error:
RuntimeError: Unable to open /tmp/_MEIJebbbx/face_recognition_models/models/shape_predictor_68_face_landmarks.dat
Full Error Message:
Traceback (most recent call last): File "Interface.py", line 6, in <module> File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "/home/samrat/Documents/Facial-Recognition-Attendance-Tracker/venv/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.__dict__) File "Camera.py", line 5, in <module> File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "/home/samrat/Documents/Facial-Recognition-Attendance-Tracker/venv/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.__dict__) File "face_recognition/__init__.py", line 7, in <module> File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "/home/samrat/Documents/Facial-Recognition-Attendance-Tracker/venv/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.__dict__) File "face_recognition/api.py", line 20, in <module> RuntimeError: Unable to open /tmp/_MEI4LEO3U/face_recognition_models/models/shape_predictor_68_face_landmarks.dat [9073] Failed to execute script Interface
Any and all insight is appreciated. Thanks!
Did you find any solution?
Use pyinstaller -c PyFileName.py (with console) or pyinstaller -w PyFileName.py (without console) instead of pyinstaller --onefile PyFileName.py. Then add folder containing face_recognition models .dat files. Example, "face_recognition_models/models/shape_predictor_68_face_landmarks.dat" in the same folder of the executable file.