Python: When trying to compile to exe missing module 'queue'? - python-3.x

With both pyinstaller and cxfreeze I get this error:
C:\Users\asdasda\Desktop\dist>test.exe
Traceback (most recent call last):
File "site-packages\requests\packages\__init__.py", line 27, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\packages\urllib3\__init__.py", line 8, in <module
>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\packages\urllib3\connectionpool.py", line 28, in
<module>
File "site-packages\requests\packages\urllib3\packages\six.py", line 203, in l
oad_module
File "site-packages\requests\packages\urllib3\packages\six.py", line 115, in _
resolve
File "site-packages\requests\packages\urllib3\packages\six.py", line 82, in _i
mport_module
ImportError: No module named 'queue'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 1, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\__init__.py", line 63, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\utils.py", line 24, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\_internal_utils.py", line 11, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\compat.py", line 11, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\requests\packages\__init__.py", line 29, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\urllib3\__init__.py", line 8, in <module>
File "c:\python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py",
line 389, in load_module
exec(bytecode, module.__dict__)
File "site-packages\urllib3\connectionpool.py", line 28, in <module>
File "site-packages\urllib3\packages\six.py", line 203, in load_module
File "site-packages\urllib3\packages\six.py", line 115, in _resolve
File "site-packages\urllib3\packages\six.py", line 82, in _import_module
ImportError: No module named 'queue'
Failed to execute script test
I tried compiling the exact same script that I compiled a few months ago (It worked that time) but now I get the error which made me think that it was a python version error, so I switched from 3.4.4 to 3.5.2 but that didn't help.
I also tried different versions of pyinstaller and cxfreeze but all gave me the same error.
Please help me regarding this issue. Thanks in Advance.

cxfreeze seems to not support the most recent version requests. This error was fixed for me by downgrading to v2.11.1
pip install requests==2.11.1

Sometimes imports are not detected. I had the same problem with the queue module.
Adding the queue module to the hidden imports in the .spec file solved the problem for me (PyInstaller):
a = Analysis(...,
hiddenimports=['queue'],
...)
source

Related

When I perform "rasa init" error: "failed to install native tensorflow runtime"

When I perform "rasa init" operation it throws the following error: "failed to install native tensorflow runtime". I tried upgrading it to tensor flow =1.15 but rasa uses only tensorflow>2.1.
Traceback (most recent call last):
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "c:\users\udays.conda\envs\chatbots\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "c:\users\udays.conda\envs\chatbots\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\udays.conda\envs\chatbots\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "c:\users\udays.conda\envs\chatbots\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\udays.conda\envs\chatbots\Scripts\rasa.exe__main__.py", line 7, in
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\rasa__main__.py", line 82, in main
set_log_level(log_level)
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\rasa\utils\common.py", line 71, in set_log_level
update_tensorflow_log_level()
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\rasa\utils\common.py", line 107, in update_tensorflow_log_level
import tensorflow as tf
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow__init__.py", line 101, in
from tensorflow_core import *
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core__init__.py", line 40, in
from tensorflow.python.tools import module_util as _module_util
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow__init__.py", line 50, in getattr
module = self._load()
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow__init__.py", line 44, in _load
module = _importlib.import_module(self.name)
File "c:\users\udays.conda\envs\chatbots\lib\importlib__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python__init__.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python\pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "c:\users\udays.conda\envs\chatbots\lib\site-packages\tensorflow_core\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "c:\users\udays.conda\envs\chatbots\lib\imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "c:\users\udays.conda\envs\chatbots\lib\imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
I also faced the same issue. I fixed it by installing c++ build tool using the below link.
https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16

Could not import flask_api.parsers.JSONParser for API setting DEFAULT_PARSERS

I have a flask project with multiple scripts ,templates and static folder.
I am using multiple flask modules like flask_pymongo,flask_cors and flask_api.
I'm trying to build executable windows program in .EXE format with PyInstaller.
I run the following command
`python -m PyInstaller -F --add-data "templates;templates" --add-data "static;static"`
and it builds successfully.
62 INFO: PyInstaller: 3.5
62 INFO: Python: 3.6.0
62 INFO: Platform: Windows-8.1-6.3.9600-SP0
64 INFO: wrote C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\__init__.spec
65 INFO: UPX is not available.
66 INFO: Extending PYTHONPATH with paths
['C:\\Users\\mohammadreza\\PycharmProjects\\nobina\\nobina_exe',
'C:\\Users\\mohammadreza\\PycharmProjects\\nobina\\nobina_exe\\nobina']
66 INFO: checking Analysis
119 INFO: Appending 'datas' from .spec
123 INFO: checking PYZ
152 INFO: checking PKG
158 INFO: Building because toc changed
159 INFO: Building PKG (CArchive) PKG-00.pkg
2676 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
2711 INFO: Bootloader C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
2711 INFO: checking EXE
2719 INFO: Building because toc changed
2719 INFO: Building EXE from EXE-00.toc
2720 INFO: Appending archive to EXE C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\dist\__init__.exe
3310 INFO: Building EXE from EXE-00.toc completed successfully.
But when i try to run my program in dist folder i get the following error:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\Users\mohammadreza>cd C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe
\nobina\dist
C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\dist>__init__.exe
Traceback (most recent call last):
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\settings.py", line 25, in import_from_string
module = importlib.import_module(module_path)
File "C:\Users\mohammadreza\AppData\Local\Programs\Python\Python36\lib\importl
ib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 948, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'flask_api.parsers'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\__init__.
py", line 22, in <module>
from nobina.installation import install
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\__init__.
py", line 22, in <module>
from nobina.installation import install
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\installat
ion.py", line 3, in <module>
from nobina.Models.Admin import Admin
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\Models\Ad
min.py", line 1, in <module>
from nobina.Models.Base import BaseModel, AggregateQuery
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\Models\Ba
se.py", line 1, in <module>
from nobina.utility import load_class, dump_class
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\nobina\utility.p
y", line 2, in <module>
from flask_api import status
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\__init__.py", line 1, in <module>
from flask_api.app import FlaskAPI
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\app.py", line 6, in <module>
from flask_api.request import APIRequest
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\request.py", line 13, in <module>
class APIRequest(Request):
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\request.py", line 14, in APIRequest
parser_classes = default_settings.DEFAULT_PARSERS
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\settings.py", line 45, in DEFAULT_PARSERS
return perform_imports(val, 'DEFAULT_PARSERS')
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\settings.py", line 13, in perform_imports
return [perform_imports(item, setting_name) for item in val]
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\settings.py", line 13, in <listcomp>
return [perform_imports(item, setting_name) for item in val]
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\settings.py", line 11, in perform_imports
return import_from_string(val, setting_name)
File "C:\Users\mohammadreza\PycharmProjects\nobina\nobina_exe\venv\lib\site-pa
ckages\flask_api\settings.py", line 30, in import_from_string
raise ImportError(msg)
ImportError: Could not import 'flask_api.parsers.JSONParser' for API setting 'DE
FAULT_PARSERS'. No module named 'flask_api.parsers'.
[6808] Failed to execute script __init__
I tried downgrading flask-api to v1.0 and it didn't work out either.
Any help will be appreciated.
i added --hidden-import=flask_api.parsers & --hidden-import=flask_api.renderers and it works

error in running exe made by using pyinstaller having sklearn packages and xgboost

i have made a exe file from a python file which have multiple import from our own files and have package sklearn, xgboost, pandas and other sklaern packages. during exe preparation thier is no error while running it it throw error
Traceback (most recent call last):
File "probability_score_engine.py", line 16, in <module>
import sklearn.ensemble
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\__init__.py", line 76, in <module>
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\base.py", line 16, in <module>
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\utils\__init__.py", line 20, in <module>
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\utils\validation.py", line 21, in
<module>
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\sklearn\utils\fixes.py", line 18, in <module>
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\scipy\sparse\linalg\__init__.py", line 113, in
<module>
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\scipy\sparse\linalg\isolve\__init__.py", line 6,
in <module>
File "C:\Users\ShubhamSingh\PycharmProjects\cfna_scoring\venv\lib\site-
packages\PyInstaller\loader\pyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\scipy\sparse\linalg\isolve\iterative.py", line 10,
in <module>
ImportError: DLL load failed: The specified module could not be found.
[10668] Failed to execute script probability_score_engine
i have use add data for xgboost when it throw error in not finding dll files for xgboost but it throw error for sklearn. i have made a exe of one file but that file call other other python files function by using import.
Both sklearn and xgboost needs special care when using with Pyinstaller. I'm skipping importing xgboost but here is a useful answer about using it with Pyinstaller.
It seems that when you add xgboostPyinstaller can't handle some modules like scipy. A simple approach is to add the whole scipy in Python's sit-package to your executable as data. So edit your spec file and add this after Analysis:
# -*- mode: python -*-
block_cipher = None
a = Analysis(
datas=[('./env/xgboost/*', 'xgboost/'), ('./env/Lib/site-packages/xgboost/VERSION', 'xgboost/')],
...
)
# add here
a.datas += Tree('<path_to_scipy_in_python_dir>', prefix='scipy')
...
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
And finally, generate your executable with pyinstaller script.spec.

Created exe from .py using pyinstaller has issues with tensorflow path

Using pyinstaller I have created an exe from python script.
The script has dependency on tensorflow. The package is created perfectly.
The issue is when I run the exe.
Python 3.6.5
Pyinstaller 3.3.1
Build platform : Win 8.1 64bit
Running platform Win 7 64bit
C:\Program Files\test\FaceDetectionPackageBeta1\dist\FaceDetection>FaceDetection.exe
Using TensorFlow backend.
Traceback (most recent call last):
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14,
in swig_import_helper
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_inter
nal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <modu
le>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17,
in <module>
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16,
in swig_import_helper
File "importlib\__init__.py", line 126, in import_module
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 714, in load_module
ImportError: DLL load failed with error code -1073741795
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "TELFaceDetection.py", line 12, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\keras\__init__.py", line 3, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\keras\utils\__init__.py", line 6, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\keras\utils\conv_utils.py", line 9, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\keras\backend\__init__.py", line 89, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\keras\backend\tensorflow_backend.py", line 5, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\tensorflow\__init__.py", line 24, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\tensorflow\python\__init__.py", line 49, in <module>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <modu
le>
ImportError: Traceback (most recent call last):
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 14,
in swig_import_helper
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tensorflow.python._pywrap_tensorflow_inter
nal'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <modu
le>
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 631, in exec_module
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 17,
in <module>
File "site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 16,
in swig_import_helper
File "importlib\__init__.py", line 126, in import_module
File "c:\program files\python36\lib\site-packages\PyInstaller\loader\pyimod03_
importers.py", line 714, in load_module
ImportError: DLL load failed with error code -1073741795
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
[4988] Failed to execute script TELFaceDetection
Below is the spec file
# -*- mode: python -*-
block_cipher = None
a = Analysis(['FaceDetection.py'],
pathex=['D:\\FaceDetectionSetup\\FaceDetectioPackageSource'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='FaceDetection',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='FaceDetection')
I have tried the solution in link, but that does not work either. when I execute the exe, No module named tensorflow.python.framework.load_library error is received.
How do I set the path so that relative path is picked.
The same worked without any issues on Win 7 64bit desktop system.So working on one system and not on the other.Any help appreciated.
Thanks
-Megha
if getattr(sys, 'frozen', False):
appPath = os.path.dirname(sys.executable)
else:
appPath = os.path.dirname(os.path.realpath(__file__))
Using this code you can specify your application directory path variable for executable as well as when running .py directly.

PyInstaller statsmodels.stats.diagnostic import kstest_normal

I'm using pyinstaller on one of my scripts but I'm getting an error on the line of code I wrote:
from statsmodels.stats.diagnostic import kstest_normal
The command I used was
pyinstaller fitness_of_statistical_tests.py --hidden-import=scipy.linalg.cython_blas --hidden-import=scipy.linalg.cython_lapack
The full error I get is:
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\pandas\__init__.py", line 7, in <module>
from pandas import hashtable, tslib, lib
ImportError: cannot import name 'lib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 9, in <module>
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "D:\SEDS\gahndiwashingtonmethod\fitness_of_statistical_tests_view.py", line 11, in <module>
from statsmodels.stats.diagnostic import kstest_normal
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\statsmodels\__init__.py", line 8, in <module>
from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning,
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\statsmodels\tools\__init__.py", line 1, in <module>
from .tools import add_constant, categorical
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\statsmodels\tools\tools.py", line 11, in <module>
from statsmodels.datasets import webuse
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\statsmodels\datasets\__init__.py", line 5, in <module>
from . import (anes96, cancer, committee, ccard, copper, cpunish, elnino,
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\statsmodels\datasets\anes96\__init__.py", line 1, in <module>
from .data import *
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\statsmodels\datasets\anes96\data.py", line 90, in <module>
from statsmodels.datasets import utils as du
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\statsmodels\datasets\utils.py", line 13, in <module>
from pandas import read_csv, DataFrame, Index
File "C:\Python34\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 311, in load_module
exec(bytecode, module.__dict__)
File "C:\Python34\lib\site-packages\pandas\__init__.py", line 13, in <module>
"extensions first.".format(module))
ImportError: C extension: 'lib' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.
fitness_of_statistical_tests returned -1
All of these imports work in the python interpreter, but it's just when I run the exe from PyInstaller that all this stuff breaks.

Resources