PyInstaller Django compilation <frozen importlib._bootstrap> - python

I'm trying to compile my django Project With PyInstaller, cuz of be safe in a shared disk driver That every One can review My Code.
and when Compile I get this output:
(env) D:__DEV__>pyinstaller Chortke/manage.py --onedir
222 INFO: PyInstaller: 4.0.dev0+46286a1f4
222 INFO: Python: 3.7.4 (conda)
222 INFO: Platform: Windows-10-10.0.16299-SP0
222 INFO: wrote D:\__DEV__\manage.spec
222 INFO: UPX is not available.
239 INFO: Extending PYTHONPATH with paths
['D:\\__DEV__\\Chortke', 'D:\\__DEV__']
239 INFO: checking Analysis
239 INFO: Building Analysis because Analysis-00.toc is non existent
239 INFO: Initializing module dependency graph...
244 INFO: Caching module graph hooks...
256 INFO: Analyzing base_library.zip ...
6561 INFO: Caching module dependency graph...
6664 INFO: running Analysis Analysis-00.toc
6679 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\mab\.conda\envs\env\python.exe
7249 INFO: Analyzing D:\__DEV__\Chortke\manage.py
7307 INFO: Processing pre-find module path hook distutils
7311 INFO: distutils: retargeting to non-venv dir 'c:\\users\\mab\\.conda\\envs\\env\\lib'
8887 INFO: Processing pre-find module path hook site
8887 INFO: site: retargeting to fake-dir 'c:\\users\\mab\\.conda\\envs\\env\\lib\\site-packages\\PyInstaller\\fake-modules'
15264 INFO: Processing module hooks...
15264 INFO: Loading module hook "hook-distutils.py"...
15264 INFO: Loading module hook "hook-django.core.cache.py"...
15439 INFO: Loading module hook "hook-django.core.mail.py"...
15601 INFO: Loading module hook "hook-django.core.management.py"...
15634 INFO: Import to be excluded not found: 'tkinter'
15635 INFO: Import to be excluded not found: 'IPython'
15635 INFO: Import to be excluded not found: 'matplotlib'
15635 INFO: Loading module hook "hook-django.db.backends.py"...
17084 WARNING: Hidden import "django.db.backends.__pycache__.base" not found!
17084 INFO: Loading module hook "hook-django.py"...
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 36, in walk_packages
File "<string>", line 36, in walk_packages
File "<string>", line 20, in walk_packages
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\admin\__init__.py", line 5, in <module>
from django.contrib.gis.admin.options import GeoModelAdmin, OSMGeoAdmin
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\admin\options.py", line 2, in <module>
from django.contrib.gis.admin.widgets import OpenLayersWidget
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\admin\widgets.py", line 3, in <module>
from django.contrib.gis.gdal import GDALException
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\gdal\__init__.py", line 28, in <module>
from django.contrib.gis.gdal.datasource import DataSource
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\gdal\datasource.py", line 39, in <module>
from django.contrib.gis.gdal.driver import Driver
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\gdal\driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\gdal\prototypes\ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 43, in <module>
% '", "'.join(lib_names)
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal203", "gdal202", "gdal201", "gdal20", "gdal111"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
19403 INFO: Determining a mapping of distributions to packages...
24054 INFO: Packages required by django:
['sqlparse', 'pytz']
24054 INFO: Django root directory D:\__DEV__\Chortke\chortke
Traceback (most recent call last):
File "c:\users\mab\.conda\envs\env\lib\site-packages\PyInstaller\utils\hooks\subproc\django_import_finder.py", line 37, in <module>
list(settings.TEMPLATE_LOADERS) + \
File "c:\users\mab\.conda\envs\env\lib\site-packages\django\conf\__init__.py", line 80, in __getattr__
val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'TEMPLATE_CONTEXT_PROCESSORS'
25398 INFO: Collecting Django migration scripts.
31358 INFO: Loading module hook "hook-encodings.py"...
31458 INFO: Loading module hook "hook-PIL.Image.py"...
32433 INFO: Loading module hook "hook-PIL.py"...
32433 INFO: Excluding import 'PySide'
32433 INFO: Removing import of PySide from module PIL.ImageQt
32449 INFO: Excluding import 'PyQt4'
32452 INFO: Removing import of PyQt4 from module PIL.ImageQt
32452 INFO: Excluding import 'PyQt5'
32454 INFO: Removing import of PyQt5 from module PIL.ImageQt
32455 INFO: Excluding import 'tkinter'
32458 INFO: Removing import of tkinter from module PIL.ImageTk
32458 INFO: Import to be excluded not found: 'FixTk'
32458 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
32460 INFO: Excluding import 'tkinter'
32462 INFO: Import to be excluded not found: 'FixTk'
32462 INFO: Loading module hook "hook-pkg_resources.py"...
32934 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
33011 INFO: Processing pre-safe import module hook win32com
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
33134 INFO: Excluding import '__main__'
33136 INFO: Removing import of __main__ from module pkg_resources
33136 INFO: Loading module hook "hook-pydoc.py"...
33137 INFO: Loading module hook "hook-pytz.py"...
33208 INFO: Loading module hook "hook-sqlite3.py"...
33307 INFO: Loading module hook "hook-sysconfig.py"...
33307 INFO: Loading module hook "hook-xml.dom.domreg.py"...
33307 INFO: Loading module hook "hook-xml.py"...
33307 INFO: Loading module hook "hook-_tkinter.py"...
33579 INFO: checking Tree
33579 INFO: Building Tree because Tree-00.toc is non existent
33579 INFO: Building Tree Tree-00.toc
33663 INFO: checking Tree
33663 INFO: Building Tree because Tree-01.toc is non existent
33663 INFO: Building Tree Tree-01.toc
33683 INFO: Loading module hook "hook-django.db.backends.mysql.base.py"...
33697 INFO: Loading module hook "hook-django.db.backends.oracle.base.py"...
33806 INFO: Looking for ctypes DLLs
33894 INFO: Analyzing run-time hooks ...
33900 INFO: Including run-time hook 'pyi_rth_pkgres.py'
33901 INFO: Including run-time hook 'pyi_rth_django.py'
33907 INFO: Looking for dynamic libraries
34271 INFO: Looking for eggs
34271 INFO: Using Python library c:\users\mab\.conda\envs\env\python37.dll
34271 INFO: Found binding redirects:
[]
34271 INFO: Warnings written to D:\__DEV__\build\manage\warn-manage.txt
34435 INFO: Graph cross-reference written to D:\__DEV__\build\manage\xref-manage.html
34710 INFO: checking PYZ
34710 INFO: Building PYZ because PYZ-00.toc is non existent
34710 INFO: Building PYZ (ZlibArchive) D:\__DEV__\build\manage\PYZ-00.pyz
35823 INFO: Building PYZ (ZlibArchive) D:\__DEV__\build\manage\PYZ-00.pyz completed successfully.
35874 INFO: checking PKG
35875 INFO: Building PKG because PKG-00.toc is non existent
35875 INFO: Building PKG (CArchive) PKG-00.pkg
35896 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
35904 INFO: Bootloader c:\users\mab\.conda\envs\env\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
35904 INFO: checking EXE
35904 INFO: Building EXE because EXE-00.toc is non existent
35905 INFO: Building EXE from EXE-00.toc
35905 INFO: Appending archive to EXE D:\__DEV__\build\manage\manage.exe
36000 INFO: Building EXE from EXE-00.toc completed successfully.
36014 INFO: checking COLLECT
36015 INFO: Building COLLECT because COLLECT-00.toc is non existent
36015 INFO: Building COLLECT COLLECT-00.toc
134331 INFO: Building COLLECT COLLECT-00.toc completed successfully.
And When i Run the exe file, I get this Error:
(env) D:__DEV__>dist\manage\manage.exe runserver
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
File "threading.py", line 926, in _bootstrap_inner
File "threading.py", line 870, in run
File "site-packages\django\utils\autoreload.py", line 54, in wrapper
File "D:\__DEV__\dist\manage\django\core\management\commands\runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "site-packages\django\utils\autoreload.py", line 77, in raise_last_exception
File "site-packages\django\core\management\__init__.py", line 337, in execute
File "site-packages\django\utils\autoreload.py", line 54, in wrapper
File "site-packages\django\__init__.py", line 24, in setup
File "site-packages\django\apps\registry.py", line 91, in populate
File "site-packages\django\apps\config.py", line 90, in create
File "importlib\__init__.py", line 127, in import_module
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'django_admin_select2'
Traceback (most recent call last):
File "manage.py", line 15, in <module>
File "site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
File "site-packages\django\core\management\__init__.py", line 375, in execute
File "site-packages\django\core\management\base.py", line 323, in run_from_argv
File "D:\__DEV__\dist\manage\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "site-packages\django\core\management\base.py", line 364, in execute
File "D:\__DEV__\dist\manage\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "D:\__DEV__\dist\manage\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "site-packages\django\utils\autoreload.py", line 598, in run_with_reloader
File "site-packages\django\utils\autoreload.py", line 583, in start_django
File "site-packages\django\utils\autoreload.py", line 301, in run
File "site-packages\django\utils\autoreload.py", line 307, in run_loop
File "site-packages\django\utils\autoreload.py", line 347, in tick
File "site-packages\django\utils\autoreload.py", line 363, in snapshot_files
File "site-packages\django\utils\autoreload.py", line 262, in watched_files
File "site-packages\django\utils\autoreload.py", line 103, in iter_all_python_module_files
File "site-packages\django\utils\autoreload.py", line 139, in iter_modules_and_files
File "pathlib.py", line 1346, in exists
File "pathlib.py", line 1168, in stat
OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: '<frozen importlib._bootstrap>'
[5108] Failed to execute script manage
Plugins that installed:
(env) D:__DEV__>pip freeze
altgraph==0.16.1
astroid==2.2.5
backports.csv==1.0.7
certifi==2019.6.16
colorama==0.4.1
defusedxml==0.6.0
diff-match-patch==20181111
Django==2.2.4
django-admin-rangefilter==0.5.0
django-admin-select2==1.0.1
django-import-export==1.2.0
django-jalali==3.1.0
django-modeladmin-reorder==0.3.1
django-nested-admin==3.2.3
et-xmlfile==1.0.1
Faker==1.0.7
future==0.17.1
isort==4.3.21
jdatetime==3.2.0
jdcal==1.4.1
lazy-object-proxy==1.4.1
mccabe==0.6.1
odfpy==1.4.0
openpyxl==2.6.2
pefile==2019.4.18
Pillow==6.1.0
PyInstaller==4.0.dev0+46286a1f4
pylint==2.3.1
python-dateutil==2.8.0
python-monkey-business==1.0.0
pytz==2019.2
pywin32-ctypes==0.2.0
PyYAML==5.1.2
six==1.12.0
sqlparse==0.3.0
tablib==0.13.0
text-unidecode==1.2
typed-ast==1.4.0
wincertstore==0.2
wrapt==1.11.2
xlrd==1.2.0
xlwt==1.3.0

In my system i used to downgrade the django version from 2.2 to 1.8 in pyinstaller 3.4 version(pyinstaller 3.5 leads to kind of numpy error). Afterwards this error was resolved.
Refer this link
Django Middleware Error - Middleware changed for 1.7

Related

miniaudio (and other modules) - can't create exe

i have just one line of code, and i am trying to generate the exe with pyinstaller command.
import miniaudio
command = pyinstaller <filename>.py
output:
116 INFO: PyInstaller: 4.2
116 INFO: Python: 3.9.2
117 INFO: Platform: Windows-10-10.0.19041-SP0
118 INFO: wrote C:\Users\Χρήστος\Desktop\radio\peradio2.spec
121 INFO: UPX is not available.
122 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Χρήστος\\Desktop\\radio', 'C:\\Users\\Χρήστος\\Desktop\\radio']
135 INFO: checking Analysis
138 INFO: Building because C:\Users\Χρήστος\Desktop\radio\peradio2.py changed
138 INFO: Initializing module dependency graph...
141 INFO: Caching module graph hooks...
148 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
152 INFO: Analyzing base_library.zip ...
2350 INFO: Processing pre-find module path hook distutils from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2351 INFO: distutils: retargeting to non-venv dir 'c:\\python\\lib'
5208 INFO: Caching module dependency graph...
5297 INFO: running Analysis Analysis-00.toc
5314 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\python\python.exe
5389 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\python\python39.dll
5564 INFO: Analyzing C:\Users\Χρήστος\Desktop\radio\peradio2.py
5566 INFO: Processing module hooks...
5567 INFO: Loading module hook 'hook-difflib.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5569 INFO: Excluding import of doctest from module difflib
5569 INFO: Loading module hook 'hook-distutils.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5570 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5572 INFO: Excluding import of lib2to3.refactor from module distutils.util
5572 INFO: Loading module hook 'hook-encodings.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5642 INFO: Loading module hook 'hook-heapq.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5643 INFO: Excluding import of doctest from module heapq
5644 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5697 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5699 INFO: Excluding import of test from module multiprocessing.util
5699 INFO: Excluding import of test.support from module multiprocessing.util
5700 INFO: Loading module hook 'hook-pickle.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5701 INFO: Excluding import of argparse from module pickle
5701 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5702 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5703 INFO: Loading module hook 'hook-xml.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5760 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks'...
5896 INFO: checking Tree
5959 INFO: checking Tree
6148 INFO: checking Tree
6165 INFO: Looking for ctypes DLLs
6188 INFO: Analyzing run-time hooks ...
6191 INFO: Including run-time hook 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
6196 INFO: Looking for dynamic libraries
6320 INFO: Looking for eggs
6321 INFO: Using Python library c:\python\python39.dll
6321 INFO: Found binding redirects:
[]
6325 INFO: Warnings written to C:\Users\Χρήστος\Desktop\radio\build\peradio2\warn-peradio2.txt
6359 INFO: Graph cross-reference written to C:\Users\Χρήστος\Desktop\radio\build\peradio2\xref-peradio2.html
6366 INFO: checking PYZ
6375 INFO: Building because toc changed
6375 INFO: Building PYZ (ZlibArchive) C:\Users\Χρήστος\Desktop\radio\build\peradio2\PYZ-00.pyz
6905 INFO: Building PYZ (ZlibArchive) C:\Users\Χρήστος\Desktop\radio\build\peradio2\PYZ-00.pyz completed successfully.
6912 INFO: checking PKG
6920 INFO: Building because toc changed
6920 INFO: Building PKG (CArchive) PKG-00.pkg
6940 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
6941 INFO: Bootloader c:\python\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
6942 INFO: checking EXE
6951 INFO: Rebuilding EXE-00.toc because peradio2.exe missing
6952 INFO: Building EXE from EXE-00.toc
7007 INFO: Copying icons from ['c:\\python\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-console.ico']
7071 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
7071 INFO: Writing RT_ICON 1 resource with 3752 bytes
7072 INFO: Writing RT_ICON 2 resource with 2216 bytes
7073 INFO: Writing RT_ICON 3 resource with 1384 bytes
7073 INFO: Writing RT_ICON 4 resource with 37019 bytes
7073 INFO: Writing RT_ICON 5 resource with 9640 bytes
7074 INFO: Writing RT_ICON 6 resource with 4264 bytes
7074 INFO: Writing RT_ICON 7 resource with 1128 bytes
7103 INFO: Appending archive to EXE C:\Users\Χρήστος\Desktop\radio\build\peradio2\peradio2.exe
7261 INFO: Building EXE from EXE-00.toc completed successfully.
7264 INFO: checking COLLECT
7264 INFO: Building COLLECT because COLLECT-00.toc is non existent
7265 INFO: Building COLLECT COLLECT-00.toc
7570 INFO: Building COLLECT COLLECT-00.toc completed successfully.
C:\Users\Χρήστος\Desktop\radio>pyinstaller --hidden-import=miniaudio peradio2.py
118 INFO: PyInstaller: 4.2
119 INFO: Python: 3.9.2
120 INFO: Platform: Windows-10-10.0.19041-SP0
121 INFO: wrote C:\Users\Χρήστος\Desktop\radio\peradio2.spec
123 INFO: UPX is not available.
130 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Χρήστος\\Desktop\\radio', 'C:\\Users\\Χρήστος\\Desktop\\radio']
144 INFO: checking Analysis
154 INFO: Building because hiddenimports changed
155 INFO: Initializing module dependency graph...
158 INFO: Caching module graph hooks...
165 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
169 INFO: Analyzing base_library.zip ...
2849 INFO: Processing pre-find module path hook distutils from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2849 INFO: distutils: retargeting to non-venv dir 'c:\\python\\lib'
4998 INFO: Caching module dependency graph...
5090 INFO: running Analysis Analysis-00.toc
5103 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\python\python.exe
5161 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\python\python39.dll
5373 INFO: Analyzing C:\Users\Χρήστος\Desktop\radio\peradio2.py
6202 INFO: Processing pre-find module path hook site from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
6203 INFO: site: retargeting to fake-dir 'c:\\python\\lib\\site-packages\\PyInstaller\\fake-modules'
8558 INFO: Processing pre-safe import module hook six.moves from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-six.moves.py'.
11175 INFO: Processing module hooks...
11175 INFO: Loading module hook 'hook-pycparser.py' from 'c:\\python\\lib\\site-packages\\pyinstaller_hooks_contrib-2021.1-py3.9.egg\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
11177 INFO: Loading module hook 'hook-pytest.py' from 'c:\\python\\lib\\site-packages\\pyinstaller_hooks_contrib-2021.1-py3.9.egg\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
Traceback (most recent call last):
File "c:\python\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
exec(code, spec_namespace)
File "C:\Users\Χρήστος\Desktop\radio\peradio2.spec", line 6, in <module>
a = Analysis(['peradio2.py'],
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
self.__postinit__()
File "c:\python\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 420, in assemble
self.graph.process_post_graph_hooks()
File "c:\python\lib\site-packages\PyInstaller\depend\analysis.py", line 367, in process_post_graph_hooks
module_hook.post_graph()
File "c:\python\lib\site-packages\PyInstaller\depend\imphook.py", line 447, in post_graph
self._load_hook_module()
File "c:\python\lib\site-packages\PyInstaller\depend\imphook.py", line 408, in _load_hook_module
self._hook_module = importlib_load_source(
File "c:\python\lib\site-packages\PyInstaller\compat.py", line 598, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 469, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 969, in load_module
File "<frozen importlib._bootstrap_external>", line 794, in load_module
File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "c:\python\lib\site-packages\pyinstaller_hooks_contrib-2021.1-py3.9.egg\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-pytest.py", line 18, in <module>
import pytest
File "c:\python\lib\site-packages\pytest.py", line 8, in <module>
from _pytest.assertion import register_assert_rewrite
File "c:\python\lib\site-packages\_pytest\assertion\__init__.py", line 13, in <module>
from _pytest.assertion import rewrite
File "c:\python\lib\site-packages\_pytest\assertion\rewrite.py", line 24, in <module>
from _pytest.assertion import util
File "c:\python\lib\site-packages\_pytest\assertion\util.py", line 11, in <module>
import _pytest._code
File "c:\python\lib\site-packages\_pytest\_code\__init__.py", line 7, in <module>
from .code import Code # noqa
File "c:\python\lib\site-packages\_pytest\_code\code.py", line 15, in <module>
import pluggy
File "c:\python\lib\site-packages\pluggy\__init__.py", line 16, in <module>
from .manager import PluginManager, PluginValidationError
File "c:\python\lib\site-packages\pluggy\manager.py", line 6, in <module>
import importlib_metadata
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 471, in <module>
__version__ = version(__name__)
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 438, in version
return distribution(package).version
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 411, in distribution
return Distribution.from_name(package)
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 179, in from_name
dists = resolver(name)
File "<frozen importlib._bootstrap_external>", line 1389, in find_distributions
File "c:\python\lib\importlib\metadata.py", line 487, in find_distributions
found = cls._search_paths(context.name, context.path)
AttributeError: 'str' object has no attribute 'name'
C:\Users\Χρήστος\Desktop\radio>pyinstaller peradio2.py
118 INFO: PyInstaller: 4.2
118 INFO: Python: 3.9.2
119 INFO: Platform: Windows-10-10.0.19041-SP0
120 INFO: wrote C:\Users\Χρήστος\Desktop\radio\peradio2.spec
123 INFO: UPX is not available.
125 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Χρήστος\\Desktop\\radio', 'C:\\Users\\Χρήστος\\Desktop\\radio']
138 INFO: checking Analysis
141 INFO: Building because C:\Users\Χρήστος\Desktop\radio\peradio2.py changed
141 INFO: Initializing module dependency graph...
144 INFO: Caching module graph hooks...
151 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
155 INFO: Analyzing base_library.zip ...
2197 INFO: Processing pre-find module path hook distutils from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2197 INFO: distutils: retargeting to non-venv dir 'c:\\python\\lib'
5129 INFO: Caching module dependency graph...
5250 INFO: running Analysis Analysis-00.toc
5267 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\python\python.exe
5342 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\python\python39.dll
5538 INFO: Analyzing C:\Users\Χρήστος\Desktop\radio\peradio2.py
6348 INFO: Processing pre-find module path hook site from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
6351 INFO: site: retargeting to fake-dir 'c:\\python\\lib\\site-packages\\PyInstaller\\fake-modules'
8738 INFO: Processing pre-safe import module hook six.moves from 'c:\\python\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-six.moves.py'.
11357 INFO: Processing module hooks...
11357 INFO: Loading module hook 'hook-pycparser.py' from 'c:\\python\\lib\\site-packages\\pyinstaller_hooks_contrib-2021.1-py3.9.egg\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
11359 INFO: Loading module hook 'hook-pytest.py' from 'c:\\python\\lib\\site-packages\\pyinstaller_hooks_contrib-2021.1-py3.9.egg\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
Traceback (most recent call last):
File "c:\python\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\python\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Python\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
exec(code, spec_namespace)
File "C:\Users\Χρήστος\Desktop\radio\peradio2.spec", line 6, in <module>
a = Analysis(['peradio2.py'],
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
self.__postinit__()
File "c:\python\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\python\lib\site-packages\PyInstaller\building\build_main.py", line 420, in assemble
self.graph.process_post_graph_hooks()
File "c:\python\lib\site-packages\PyInstaller\depend\analysis.py", line 367, in process_post_graph_hooks
module_hook.post_graph()
File "c:\python\lib\site-packages\PyInstaller\depend\imphook.py", line 447, in post_graph
self._load_hook_module()
File "c:\python\lib\site-packages\PyInstaller\depend\imphook.py", line 408, in _load_hook_module
self._hook_module = importlib_load_source(
File "c:\python\lib\site-packages\PyInstaller\compat.py", line 598, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 469, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 969, in load_module
File "<frozen importlib._bootstrap_external>", line 794, in load_module
File "<frozen importlib._bootstrap>", line 274, in _load_module_shim
File "<frozen importlib._bootstrap>", line 711, in _load
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "c:\python\lib\site-packages\pyinstaller_hooks_contrib-2021.1-py3.9.egg\_pyinstaller_hooks_contrib\hooks\stdhooks\hook-pytest.py", line 18, in <module>
import pytest
File "c:\python\lib\site-packages\pytest.py", line 8, in <module>
from _pytest.assertion import register_assert_rewrite
File "c:\python\lib\site-packages\_pytest\assertion\__init__.py", line 13, in <module>
from _pytest.assertion import rewrite
File "c:\python\lib\site-packages\_pytest\assertion\rewrite.py", line 24, in <module>
from _pytest.assertion import util
File "c:\python\lib\site-packages\_pytest\assertion\util.py", line 11, in <module>
import _pytest._code
File "c:\python\lib\site-packages\_pytest\_code\__init__.py", line 7, in <module>
from .code import Code # noqa
File "c:\python\lib\site-packages\_pytest\_code\code.py", line 15, in <module>
import pluggy
File "c:\python\lib\site-packages\pluggy\__init__.py", line 16, in <module>
from .manager import PluginManager, PluginValidationError
File "c:\python\lib\site-packages\pluggy\manager.py", line 6, in <module>
import importlib_metadata
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 471, in <module>
__version__ = version(__name__)
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 438, in version
return distribution(package).version
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 411, in distribution
return Distribution.from_name(package)
File "c:\python\lib\site-packages\importlib_metadata\__init__.py", line 179, in from_name
dists = resolver(name)
File "<frozen importlib._bootstrap_external>", line 1389, in find_distributions
File "c:\python\lib\importlib\metadata.py", line 487, in find_distributions
found = cls._search_paths(context.name, context.path)
AttributeError: 'str' object has no attribute 'name'
I tried to uninstall and then reinstall pyinstall six enum34 and setuptools but the error doesn't gone.
It's the first time i use miniaudio module.
Can anyone help me about?
Thanks in advance,
Chris Pappas
**Edit: ** I found that is not the only module about that problem.
pip uninstall importlib-metadata
pip install importlib-metadata
Fix the errors!!!
I had a very old version of this module 0.x . now 3.x

cannot run pyinstaller executable of a flask server. ValueError: Can't find a dictionary for language 'ru'

I'm trying to put a simple flask server into executable by using pyinstaller -F server.py command
When running the exe file, I obtain the following error:
Traceback (most recent call last):
File "server.py", line 4, 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 "c:\users\pc\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "transform.py", line 17, 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 "c:\users\pc\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
exec(bytecode, module.__dict__)
File "convert.py", line 12, in <module>
File "pymorphy2\analyzer.py", line 200, in __init__
File "pymorphy2\analyzer.py", line 280, in choose_dictionary_path
File "pymorphy2\analyzer.py", line 144, in lang_dict_path
ValueError: Can't find a dictionary for language 'ru'. Installed languages: []. Try installing pymorphy2-dicts-ru package.
[18156] Failed to execute script server
Already tried to pip install pymorphy2-dicts-ru, it didn't help
Below are the logs of pyinstaller -F server.py
96 INFO: PyInstaller: 4.1
97 INFO: Python: 3.6.8
97 INFO: Platform: Windows-10-10.0.19041-SP0
103 INFO: wrote C:\Users\pc\Desktop\hack\code\nlp-server\server.spec
118 INFO: UPX is not available.
122 INFO: Extending PYTHONPATH with paths
['C:\\Users\\pc\\Desktop\\hack\\code\\nlp-server',
'C:\\Users\\pc\\Desktop\\hack\\code\\nlp-server']
139 INFO: checking Analysis
140 INFO: Building Analysis because Analysis-00.toc is non existent
140 INFO: Initializing module dependency graph...
145 INFO: Caching module graph hooks...
169 INFO: Analyzing base_library.zip ...
3178 INFO: Caching module dependency graph...
3265 INFO: running Analysis Analysis-00.toc
3268 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\pc\appdata\local\programs\python\python36\python.exe
3440 INFO: Analyzing C:\Users\pc\Desktop\hack\code\nlp-server\server.py
4658 INFO: Processing pre-find module path hook distutils from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
4659 INFO: distutils: retargeting to non-venv dir 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib'
7000 INFO: Processing pre-safe import module hook setuptools.extern.six.moves from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-setuptools.extern.six.m
oves.py'.
7477 INFO: Processing pre-find module path hook site from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
7478 INFO: site: retargeting to fake-dir 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\fake-modules'
10016 INFO: Processing module hooks...
10017 INFO: Loading module hook 'hook-jinja2.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
10031 INFO: Loading module hook 'hook-difflib.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10034 INFO: Excluding import of doctest from module difflib
10034 INFO: Loading module hook 'hook-distutils.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10035 INFO: Loading module hook 'hook-distutils.util.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10038 INFO: Excluding import of lib2to3.refactor from module distutils.util
10038 INFO: Loading module hook 'hook-encodings.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10146 INFO: Loading module hook 'hook-heapq.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10148 INFO: Excluding import of doctest from module heapq
10149 INFO: Loading module hook 'hook-lib2to3.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10247 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10249 INFO: Import to be excluded not found: 'test'
10249 INFO: Loading module hook 'hook-numpy.core.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10827 INFO: Loading module hook 'hook-numpy.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10830 INFO: Loading module hook 'hook-numpy._pytesttester.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10832 INFO: Excluding import of pytest from module numpy._pytesttester
10833 INFO: Loading module hook 'hook-pickle.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
10835 INFO: Excluding import of argparse from module pickle
10835 INFO: Loading module hook 'hook-pkg_resources.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
11162 INFO: Processing pre-safe import module hook win32com from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
11219 INFO: Processing pre-safe import module hook win32com from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'win32com'
11462 WARNING: Hidden import "pkg_resources.py2_warn" not found!
11464 WARNING: Hidden import "pkg_resources.markers" not found!
11465 INFO: Excluding import of __main__ from module pkg_resources
11466 INFO: Loading module hook 'hook-setuptools.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
12062 INFO: Excluding import of setuptools.py27compat from module setuptools.command.easy_install
12062 INFO: Excluding import of setuptools.py27compat from module setuptools.package_index
12065 INFO: Excluding import of setuptools.py33compat from module setuptools.depends
12065 INFO: Excluding import of setuptools.py33compat from module setuptools.package_index
12066 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
12067 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
12068 INFO: Loading module hook 'hook-xml.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
12121 INFO: Loading module hook 'hook-setuptools.msvc.py' from 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks'...
12123 INFO: Excluding import of numpy from module setuptools.msvc
12199 INFO: Looking for ctypes DLLs
12231 INFO: Analyzing run-time hooks ...
12237 INFO: Including run-time hook 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
12238 INFO: Including run-time hook 'c:\\users\\pc\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
12250 INFO: Looking for dynamic libraries
13139 INFO: Looking for eggs
13139 INFO: Using Python library c:\users\pc\appdata\local\programs\python\python36\python36.dll
13139 INFO: Found binding redirects:
[]
13150 INFO: Warnings written to C:\Users\pc\Desktop\hack\code\nlp-server\build\server\warn-server.txt
13296 INFO: Graph cross-reference written to C:\Users\pc\Desktop\hack\code\nlp-server\build\server\xref-server.html
13324 INFO: checking PYZ
13325 INFO: Building PYZ because PYZ-00.toc is non existent
13326 INFO: Building PYZ (ZlibArchive) C:\Users\pc\Desktop\hack\code\nlp-server\build\server\PYZ-00.pyz
14479 INFO: Building PYZ (ZlibArchive) C:\Users\pc\Desktop\hack\code\nlp-server\build\server\PYZ-00.pyz completed successfully.
14505 INFO: checking PKG
14505 INFO: Building PKG because PKG-00.toc is non existent
14505 INFO: Building PKG (CArchive) PKG-00.pkg
20039 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
20043 INFO: Bootloader c:\users\pc\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
20043 INFO: checking EXE
20043 INFO: Building EXE because EXE-00.toc is non existent
20043 INFO: Building EXE from EXE-00.toc
20044 INFO: Appending archive to EXE C:\Users\pc\Desktop\hack\code\nlp-server\dist\server.exe
20060 INFO: Building EXE from EXE-00.toc completed successfully.
code of the server.py
from flask import Flask, request, jsonify
from transform import transform_text
server = Flask(__name__);
#server.route('/send', methods=['POST'])
def send():
print("POST /send request")
# obtaining passed args
fname = request.json['fname']
text = request.json['text']
# updating the text
text = f"{transform_text(text, 'Masc', fname)}"
# sending back updated text
return jsonify({'text': text})
if __name__ == '__main__':
server.run(host='0.0.0.0', port='8080', debug=True)
tranform_text() function uses pymorphy to change sentences from 1st person form ("I play") to 3rd person form("He/She plays")
So, is there any way to make the executable work?
This is the problem of the package ;pymorphy2_dicts_ru;. Files from the data directory are not copied to the bundle.
To solve the problem, you need to perform two steps:
Add the data directory to the pyinstaller spec file:
...
# pymorph data
import pymorphy2_dicts_ru
pymorph_data = pymorphy2_dicts_ru.get_path()
a = Analysis(['main.py'],
pathex=['.'],
binaries=[],
datas=[(pymorph_data, 'pymorphy2_dicts_ru/data')],
hiddenimports=[],
hookspath=[],
...
Set the path to the data directory in the code before import the pymorphy2 module (to main.py for example):
...
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
os.environ["PYMORPHY2_DICT_PATH"] = str(pathlib.Path(sys._MEIPASS).joinpath('pymorphy2_dicts_ru/data'))
...

Error while creating .exe using Pyinstaller

I created simple HelloWorld program and tried to create .exe using PyInstaller
.exe is created but doesnot run.
Errors while Compiling
PS E:\Pot> pyinstaller it.py
62 INFO: PyInstaller: 3.6
62 INFO: Python: 3.8.3
62 INFO: Platform: Windows-10-10.0.18362-SP0
62 INFO: wrote E:\Pot\it.spec
62 INFO: UPX is not available.
62 INFO: Extending PYTHONPATH with paths
['E:\\Pot', 'E:\\Pot']
62 INFO: checking Analysis
62 INFO: Building Analysis because Analysis-00.toc is non existent
62 INFO: Initializing module dependency graph...
62 INFO: Caching module graph hooks...
78 INFO: Analyzing base_library.zip ...
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 13, in walk_packages
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py", line 130, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py", line 149, in _iter_file_finder_modules
import inspect
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\inspect.py", line 40, in <module>
import linecache
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\linecache.py", line 11, in <module>
import tokenize
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tokenize.py", line 32, in <module>
import re
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py", line 145, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 13, in walk_packages
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py", line 130, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py", line 149, in _iter_file_finder_modules
import inspect
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\inspect.py", line 40, in <module>
import linecache
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\linecache.py", line 11, in <module>
import tokenize
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tokenize.py", line 32, in <module>
import re
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py", line 145, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
2514 INFO: Processing pre-find module path hook distutils
2514 INFO: distutils: retargeting to non-venv dir 'c:\\users\\paritosh malik\\appdata\\local\\programs\\python\\python38\\lib'
3952 INFO: Caching module dependency graph...
4014 INFO: running Analysis Analysis-00.toc
4014 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\paritosh malik\appdata\local\programs\python\python38\python.exe
4280 INFO: Analyzing E:\Pot\it.py
4280 INFO: Processing module hooks...
4280 INFO: Loading module hook "hook-distutils.py"...
4295 INFO: Loading module hook "hook-encodings.py"...
Traceback (most recent call last):
File "<string>", line 41, in <module>
File "<string>", line 13, in walk_packages
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py", line 130, in iter_modules
for name, ispkg in iter_importer_modules(i, prefix):
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\pkgutil.py", line 149, in _iter_file_finder_modules
import inspect
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\inspect.py", line 40, in <module>
import linecache
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\linecache.py", line 11, in <module>
import tokenize
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tokenize.py", line 32, in <module>
import re
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py", line 145, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
4389 INFO: Loading module hook "hook-lib2to3.py"...
4389 INFO: Loading module hook "hook-pydoc.py"...
4389 INFO: Loading module hook "hook-sysconfig.py"...
4389 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
4389 INFO: Loading module hook "hook-xml.py"...
4436 INFO: Loading module hook "hook-_tkinter.py"...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\tkinter\__init__.py", line 39, in <module>
import re
File "c:\users\paritosh malik\appdata\local\programs\python\python38\lib\re.py", line 145, in <module>
class RegexFlag(enum.IntFlag):
AttributeError: module 'enum' has no attribute 'IntFlag'
4592 ERROR: Tcl/Tk improperly installed on this system.
4608 INFO: Looking for ctypes DLLs
4655 INFO: Analyzing run-time hooks ...
4655 INFO: Including run-time hook 'pyi_rth__tkinter.py'
4655 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
4670 INFO: Looking for dynamic libraries
4717 WARNING: lib not found: pywintypes38.dll dependency of c:\users\paritosh malik\appdata\local\programs\python\python38\lib\site-packages\win32\win32evtlog.pyd
4733 WARNING: lib not found: pywintypes38.dll dependency of c:\users\paritosh malik\appdata\local\programs\python\python38\lib\site-packages\win32\win32api.pyd
4889 INFO: Looking for eggs
4889 INFO: Using Python library c:\users\paritosh malik\appdata\local\programs\python\python38\python38.dll
4889 INFO: Found binding redirects:
[]
4889 INFO: Warnings written to E:\Pot\build\it\warn-it.txt
4936 INFO: Graph cross-reference written to E:\Pot\build\it\xref-it.html
4951 INFO: checking PYZ
4951 INFO: Building PYZ because PYZ-00.toc is non existent
4951 INFO: Building PYZ (ZlibArchive) E:\Pot\build\it\PYZ-00.pyz
5529 INFO: Building PYZ (ZlibArchive) E:\Pot\build\it\PYZ-00.pyz completed successfully.
5545 INFO: checking PKG
5545 INFO: Building PKG because PKG-00.toc is non existent
5545 INFO: Building PKG (CArchive) PKG-00.pkg
5561 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
5561 INFO: Bootloader c:\users\paritosh malik\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\bootloader\Windows-64bit\run.exe
5561 INFO: checking EXE
5561 INFO: Building EXE because EXE-00.toc is non existent
5561 INFO: Building EXE from EXE-00.toc
5576 INFO: Appending archive to EXE E:\Pot\build\it\it.exe
5576 INFO: Building EXE from EXE-00.toc completed successfully.
5576 INFO: checking COLLECT
5576 INFO: Building COLLECT because COLLECT-00.toc is non existent
5592 INFO: Building COLLECT COLLECT-00.toc
5811 INFO: Building COLLECT COLLECT-00.toc completed successfully.
Error while running the .exe
PS E:\Pot> dist\it\it
Python path configuration:
PYTHONHOME = 'E:\Pot\dist\it'
PYTHONPATH = (not set)
program name = 'E:\Pot\dist\it\it.exe'
isolated = 0
environment = 0
user site = 0
import site = 0
sys._base_executable = 'E:\\Pot\\dist\\it\\it.exe'
sys.base_prefix = ''
sys.base_exec_prefix = ''
sys.executable = 'E:\\Pot\\dist\\it\\it.exe'
sys.prefix = ''
sys.exec_prefix = ''
sys.path = [
'E:\\Pot\\dist\\it\\base_library.zip',
'E:\\Pot\\dist\\it',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
LookupError: unknown encoding: utf-8
Current thread 0x000046f8 (most recent call first):
<no Python frame>
PS E:\Pot>
I tried adding "utf_8.pyc" into encodings folder in base_library.zip but then it shows some other error init_sys_streams
So I think error is in lack of files in base_library.zip
Please Help..
Please Help..
Please Help..
Please Help..
Pyinstaller doesn't support Python 3.8 yet, see this open feature request: https://github.com/pyinstaller/pyinstaller/issues/4311
Try using Python 3.7 instead.

While compiling .exe from .py file, how to fix ''ImportError: DLL load failed"?

I am new in programming. I have a Python code (named "adm_dicing.py") that includes some modules (numpy, scipy, matplotlib, etc.) and some others written by myself. It does some calculation and plot some figures (I haven't write if name = main in my code). When I compile the code on command line of Windows (I have windows 7) by entering:
"C:\ProgramData\Anaconda3\Scripts\pyinstaller.exe" adm_dicing.py
I got a mere .spec file, containing:
# -*- mode: python -*-
block_cipher = None
a = Analysis(['adm_dicing.py'],
pathex=['E:\\XiaoZhang\\Projet_R4-8_endoscope\\python codes'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='adm_dicing',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='adm_dicing')
and in the command line I have the following message and errors:
483 INFO: PyInstaller: 3.4
483 INFO: Python: 3.7.3
483 INFO: Platform: Windows-7-6.1.7601-SP1
483 INFO: wrote E:\XiaoZhang\Projet_R4-8_endoscope\python codes\adm_dicing.spec
499 INFO: UPX is not available.
500 INFO: Extending PYTHONPATH with paths
['E:\\XiaoZhang\\Projet_R4-8_endoscope\\python codes',
'E:\\XiaoZhang\\Projet_R4-8_endoscope\\python codes']
500 INFO: checking Analysis
500 INFO: Building Analysis because Analysis-00.toc is non existent
500 INFO: Initializing module dependency graph...
507 INFO: Initializing module graph hooks...
566 INFO: Analyzing base_library.zip ...
15208 INFO: running Analysis Analysis-00.toc
15253 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of
final executable
required by C:\ProgramData\Anaconda3\python.exe
16945 INFO: Caching module hooks...
16959 INFO: Analyzing E:\XiaoZhang\Projet_R4-8_endoscope\python codes\adm_dicing
.py
22825 INFO: Processing pre-find module path hook distutils
23711 INFO: Processing pre-safe import module hook six.moves
33828 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
36851 INFO: Processing pre-find module path hook site
36866 INFO: site: retargeting to fake-dir 'C:\\ProgramData\\Anaconda3\\lib\\site
-packages\\pyinstaller-3.4-py3.7.egg\\PyInstaller\\fake-modules'
99586 INFO: Processing pre-safe import module hook urllib3.packages.six.moves
162520 INFO: Processing pre-safe import module hook win32com
302047 INFO: Loading module hooks...
302047 INFO: Loading module hook "hook-babel.py"...
314303 INFO: Loading module hook "hook-bokeh.py"...
314694 INFO: Loading module hook "hook-certifi.py"...
314694 INFO: Loading module hook "hook-cryptography.py"...
316382 INFO: Loading module hook "hook-cytoolz.itertoolz.py"...
316401 INFO: Loading module hook "hook-distutils.py"...
316408 INFO: Loading module hook "hook-docutils.py"...
324213 INFO: Loading module hook "hook-encodings.py"...
324774 INFO: Loading module hook "hook-h5py.py"...
324786 INFO: Loading module hook "hook-IPython.py"...
324929 INFO: Excluding import 'matplotlib'
324945 INFO: Removing import of matplotlib.pyplot from module IPython.core.pyl
abtools
324945 INFO: Removing import of matplotlib from module IPython.core.pylabtools
324945 INFO: Removing import of matplotlib.figure from module IPython.core.pyl
abtools
324945 INFO: Removing import of matplotlib._pylab_helpers from module IPython.
core.pylabtools
324945 INFO: Excluding import 'PyQt5'
324945 INFO: Removing import of PyQt5 from module IPython.external.qt_loaders
324945 INFO: Removing import of PyQt5.QtWidgets from module IPython.external.q
t_loaders
324945 INFO: Removing import of PyQt5.QtGui from module IPython.external.qt_lo
aders
324945 INFO: Removing import of PyQt5.QtSvg from module IPython.external.qt_lo
aders
324945 INFO: Removing import of PyQt5.QtCore from module IPython.external.qt_l
oaders
324945 INFO: Excluding import 'PyQt4'
324960 INFO: Removing import of PyQt4 from module IPython.external.qt_loaders
324976 INFO: Excluding import 'PySide'
324976 INFO: Removing import of PySide from module IPython.external.qt_loaders
324976 INFO: Excluding import 'tkinter'
324991 INFO: Removing import of tkinter from module IPython.lib.clipboard
324991 INFO: Excluding import 'gtk'
324991 INFO: Loading module hook "hook-jedi.py"...
325023 INFO: Loading module hook "hook-jinja2.py"...
325038 INFO: Loading module hook "hook-jsonschema.py"...
325054 INFO: Loading module hook "hook-lib2to3.py"...
325085 INFO: Loading module hook "hook-lxml.etree.py"...
325085 INFO: Loading module hook "hook-matplotlib.backends.py"...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line
141, in <module>
from . import cbook, rcsetup
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py"
, line 33, in <module>
import numpy as np
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 140,
in <module>
from . import _distributor_init
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\_distributor_init.py",
line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
325986 INFO: Loading module hook "hook-matplotlib.py"...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\__init__.py", line
141, in <module>
from . import cbook, rcsetup
File "C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\cbook\__init__.py"
, line 33, in <module>
import numpy as np
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 140,
in <module>
from . import _distributor_init
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\_distributor_init.py",
line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
327061 INFO: Loading module hook "hook-numpy.core.py"...
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 140,
in <module>
from . import _distributor_init
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\_distributor_init.py",
line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\pkgutil.py", line 493, in find_loader
spec = importlib.util.find_spec(fullname)
File "C:\ProgramData\Anaconda3\lib\importlib\util.py", line 94, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\__init__.py", line 140,
in <module>
from . import _distributor_init
File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\_distributor_init.py",
line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\utils\hooks\__init__.py", line 320, in get_module_file_attribute
loader = pkgutil.find_loader(package)
File "C:\ProgramData\Anaconda3\lib\pkgutil.py", line 499, in find_loader
raise ImportError(msg.format(fullname, type(ex), ex)) from ex
ImportError: Error while finding loader for 'numpy.core' (<class '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:\ProgramData\Anaconda3\Scripts\pyinstaller-script.py", line 11, in <mo
dule>
load_entry_point('PyInstaller==3.4', 'console_scripts', 'pyinstaller')()
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\building\build_main.py", line 838, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\building\build_main.py", line 784, in build
exec(text, spec_namespace)
File "<string>", line 17, in <module>
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\building\build_main.py", line 241, in __init__
self.__postinit__()
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\building\build_main.py", line 500, in assemble
module_hook.post_graph()
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\building\imphook.py", line 410, in post_graph
self._load_hook_module()
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\building\imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\compat.py", line 736, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrappe
r
File "<frozen importlib._bootstrap_external>", line 907, in load_module
File "<frozen importlib._bootstrap_external>", line 732, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 696, in _load
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\hooks\hook-numpy.core.py", line 27, in <module>
pkg_base, pkg_dir = get_package_paths('numpy.core')
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\utils\hooks\__init__.py", line 537, in get_package_paths
file_attr = get_module_file_attribute(package)
File "C:\ProgramData\Anaconda3\lib\site-packages\pyinstaller-3.4-py3.7.egg\PyI
nstaller\utils\hooks\__init__.py", line 339, in get_module_file_attribute
raise ImportError
ImportError
How can I fix the problem?
Note that I have installed pywin, the last Windows Visual Studio (but not any extensions yet)
EDIT : I tried with a code that contains no imported modules, it works fine. As long as I include something like "import numpy as np", things go wrong...

Pyinstaller Tkinter hiddenimports = [sysconfig._get_sysconfigdata_name()] ERROR

When I try to convert my .py file into an app using pyinstaller, I get the following output on terminal
Rishabhs-MacBook-Pro:desktop rishabhtatia$ pyinstaller --clean --hidden-
import tkinter test.py
697 INFO: PyInstaller: 3.3.1
697 INFO: Python: 3.6.4
709 INFO: Platform: Darwin-17.4.0-x86_64-i386-64bit
711 INFO: wrote /Users/rishabhtatia/Desktop/test.spec
714 INFO: UPX is not available.
716 INFO: Removing temporary files and cleaning cache in /Users/rishabhtatia/Library/Application Support/pyinstaller
Traceback (most recent call last):
File "/Users/rishabhtatia/anaconda3/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 162, in __init__
raise ValueError("script '%s' not found" % script)
ValueError: script '/Users/rishabhtatia/Desktop/test.py' not found
Rishabhs-MacBook-Pro:desktop rishabhtatia$ pyinstaller --clean --hidden-import tkinter typeMachine.py
314 INFO: PyInstaller: 3.3.1
314 INFO: Python: 3.6.4
321 INFO: Platform: Darwin-17.4.0-x86_64-i386-64bit
323 INFO: wrote /Users/rishabhtatia/Desktop/typeMachine.spec
326 INFO: UPX is not available.
327 INFO: Removing temporary files and cleaning cache in /Users/rishabhtatia/Library/Application Support/pyinstaller
328 INFO: Extending PYTHONPATH with paths
['/Users/rishabhtatia/Desktop', '/Users/rishabhtatia/Desktop']
328 INFO: checking Analysis
328 INFO: Building Analysis because out00-Analysis.toc is non existent
328 INFO: Initializing module dependency graph...
332 INFO: Initializing module graph hooks...
334 INFO: Analyzing base_library.zip ...
4406 INFO: Analyzing hidden import 'tkinter'
4576 INFO: running Analysis out00-Analysis.toc
4586 INFO: Caching module hooks...
4590 INFO: Analyzing /Users/rishabhtatia/Desktop/typeMachine.py
4827 INFO: Processing pre-safe import module hook six.moves
5525 INFO: Processing pre-find module path hook distutils
10217 INFO: Processing pre-find module path hook site
10218 INFO: site: retargeting to fake-dir '/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/fake-modules'
16738 INFO: Loading module hooks...
16738 INFO: Loading module hook "hook-pkg_resources.py"...
17122 INFO: Processing pre-safe import module hook win32com
17433 INFO: Loading module hook "hook-PyQt5.py"...
17628 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
17630 INFO: Loading module hook "hook-lib2to3.py"...
17633 INFO: Loading module hook "hook-_tkinter.py"...
17877 INFO: checking Tree
17877 INFO: Building Tree because out00-Tree.toc is non existent
17877 INFO: Building Tree out00-Tree.toc
17888 INFO: checking Tree
17888 INFO: Building Tree because out01-Tree.toc is non existent
17889 INFO: Building Tree out01-Tree.toc
17895 INFO: Loading module hook "hook-encodings.py"...
17973 INFO: Loading module hook "hook-PIL.py"...
17979 INFO: Excluding import 'PyQt4'
17981 INFO: Removing import of PyQt4 from module PIL.ImageQt
17981 INFO: Excluding import 'PySide'
17983 INFO: Removing import of PySide from module PIL.ImageQt
17983 INFO: Excluding import 'tkinter'
17985 INFO: Import to be excluded not found: 'FixTk'
17985 INFO: Excluding import 'PyQt5'
17987 INFO: Removing import of PyQt5.QtCore from module PIL.ImageQt
17987 INFO: Removing import of PyQt5.QtGui from module PIL.ImageQt
17987 INFO: Loading module hook "hook-setuptools.py"...
18020 INFO: Loading module hook "hook-pycparser.py"...
18279 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
18847 INFO: Loading module hook "hook-PIL.Image.py"...
19267 INFO: Loading module hook "hook-PyQt5.Qt.py"...
19269 INFO: Loading module hook "hook-pytest.py"...
20348 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
20349 INFO: Loading module hook "hook-sysconfig.py"...
Traceback (most recent call last):
File "/Users/rishabhtatia/anaconda3/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 213, in __init__
self.__postinit__()
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 161, in __postinit__
self.assemble()
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 472, in assemble
module_hook.post_graph()
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/imphook.py", line 410, in post_graph
self._load_hook_module()
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/building/imphook.py", line 377, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/compat.py", line 744, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 399, in _check_name_wrapper
File "<frozen importlib._bootstrap_external>", line 823, in load_module
File "<frozen importlib._bootstrap_external>", line 682, in load_module
File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
File "<frozen importlib._bootstrap>", line 684, in _load
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/rishabhtatia/anaconda3/lib/python3.6/site-packages/PyInstaller/hooks/hook-sysconfig.py", line 42, in <module>
hiddenimports = [sysconfig._get_sysconfigdata_name()]
TypeError: _get_sysconfigdata_name() missing 1 required positional argument: 'check_exists'
I've tried to use various different commands with pyinstaller and have tried using py2app with no success.
I'm currently using
python version: 3.6.4
anaconda version: 1.6.9
macOS HighSierra
Any help on how I can successfully convert this python file into an app will be appreciated! Thank you!
I came across the same problem. Upon further investigation, it seems to be the problem with Anaconda introducing breaking changes.
Please get in touch with the anaconda people then. We can not support their distribution any longer if they add incompatible changes.
I had the same issue before, changing the conda environment's python to 3.5.1 removed that error.
I had the same error (with anaconda as well), but only with python version 3.6.4. If I downgrade to 3.6.3, the error disappears.
If you experience this issue, update your conda installation. If this does not help, get in touch with the anaconda people. We can not support their distribution any longer if they add incompatible changes.
See https://github.com/pyinstaller/pyinstaller/issues/3192 for full discussion.

Categories