I am trying to convert the script to exe using pyinstaller the script is using the inception resnet v1 model from facenet_pytorch by tim esler found here
after running the converted script exe the following error appears:
Traceback (most recent call last):
File "site-packages\torch_utils_internal.py", line 46, in get_source_lines_and_file
File "inspect.py", line 955, in getsourcelines
File "inspect.py", line 786, in findsource
OSError: could not get source code
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Fcenet-Pytorch\Test Rec2.py", line 1, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "c:\users\jorda\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.dict)
File "site-packages\facenet_pytorch__init__.py", line 1, in
# -*- coding: utf-8 -*-File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "c:\users\jorda\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.dict)
File "site-packages\facenet_pytorch\models\inception_resnet_v1.py", line 1, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "c:\users\jorda\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.dict)
File "site-packages\torch__init__.py", line 367, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "c:\users\jorda\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.dict)
File "site-packages\torch\distributions__init__.py", line 112, in
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "c:\users\jorda\appdata\local\programs\python\python37\lib\site- packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.dict)
File "site-packages\torch\distributions\von_mises.py", line 54, in
File "site-packages\torch\jit__init__.py", line 1287, in script
File "site-packages\torch\jit\frontend.py", line 164, in get_jit_def
File "site-packages\torch_utils_internal.py", line 53, in get_source_lines_and_file
OSError: Can't get source for . TorchScript requires source access in order to carry out compilation, make sure original .py files are available. Original error: could not get source code
[4348] Failed to execute script Test Rec2
some solution I've found online is to downgrade torchvision to 0.2.2.post3 but that would prevent the original script from running
I've tried all kinds of hiddenimports the same error still occurs
any idea how to fix it?
System: Windows 10
Python 3.7
torch 1.5.0
torchvision 0.6.0
pyinstaller 3.6
facenet-pytorch 2.2.9