I've been trying to use PyInstaller for some time as it can turn a Python script into a single .exe file, instead of having a lib file and DLLs like cx_freeze does for example. So it's easier for my users to update the program when I push as it's "less" stuff to download.
However, when I run "pyinstaller CLI.py", I get the following error:
76 INFO: PyInstaller: 4.3
76 INFO: Python: 3.9.5
87 INFO: Platform: Windows-10-10.0.19042-SP0
88 INFO: wrote C:\Users\Admin\Desktop\UnknownAIO\CLI.spec
91 INFO: UPX is not available.
92 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Admin\\Desktop\\UnknownAIO',
'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python39\\Lib\\site-packages\\site.py',
'C:\\Users\\Admin\\Desktop\\UnknownAIO']
104 INFO: checking Analysis
104 INFO: Building Analysis because Analysis-00.toc is non existent
104 INFO: Initializing module dependency graph...
108 INFO: Caching module graph hooks...
115 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
119 INFO: Analyzing base_library.zip ...
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 617, in <module>
main()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 604, in main
known_paths = addsitepackages(known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 387, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 226, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 175, in addpackage
f = io.TextIOWrapper(io.open_code(fullname), encoding="locale")
LookupError: unknown encoding: locale
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 617, in <module>
main()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 604, in main
known_paths = addsitepackages(known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 387, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 226, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 175, in addpackage
f = io.TextIOWrapper(io.open_code(fullname), encoding="locale")
LookupError: unknown encoding: locale
2115 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2116 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python39\\lib'
4439 INFO: Caching module dependency graph...
4528 INFO: running Analysis Analysis-00.toc
4542 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\admin\appdata\local\programs\python\python39\python.exe
4604 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\users\admin\appdata\local\programs\python\python39\python39.dll
4614 INFO: Analyzing C:\Users\Admin\Desktop\UnknownAIO\CLI.py
5032 INFO: Processing pre-find module path hook site from 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
5033 INFO: site: retargeting to fake-dir 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\fake-modules'
8190 INFO: Processing pre-safe import module hook urllib3.packages.six.moves from 'C:\\Users\\Admin\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-urllib3.packages.six.moves.py'.
Fatal Python error: init_import_site: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 617, in <module>
main()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 604, in main
known_paths = addsitepackages(known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 387, in addsitepackages
addsitedir(sitedir, known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 226, in addsitedir
addpackage(sitedir, name, known_paths)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\lib\site-packages\site.py", line 175, in addpackage
f = io.TextIOWrapper(io.open_code(fullname), encoding="locale")
LookupError: unknown encoding: locale
pre-safe-import-module hook failed, needs fixing.
Any help would be amazing.
Something is amiss with your Python installation. The "site-specific configuration hook" site.py is normally found in the Lib folder just underneath the Python install directory. But according to your error log, PyInstaller finds it in Lib/site-packages.
See also this answer from 2014:
If you have a site.py in site-packages then that is an error, there should be no such file there.
It's referring to Python 2.7, but explains well what site.py does and still applies to newer Python versions, such as Python 3.9 here.
Furthermore, the code line
f = io.TextIOWrapper(io.open_code(fullname), encoding="locale")
in your custom site.py is wrong. There is no (standard) encoding with the name 'locale'. Which is why it raises that LookupError. That same line of code in the site.py included with Python 3.9 does not use the optional encoding argument.
Related
I am new programming and when I tried to convert my .py file to an executable .exe file I get the following ERROR.
My numpy version is 1.19.1 (I have already uninstalled it and installed it again).
My Anaconda version is 1.9.12
PYTHONPATH is OK.
The error is the following when trying to get the .exe file:
Running auto-py-to-exe v2.7.6
Building directory: C:\Users\User\AppData\Local\Temp\tmp30rpmpfm
Provided command: pyinstaller --noconfirm --onedir --windowed "C:/Users/User/Documents/Python/Scripts/Italiano/conjugacion_verbos_presente/auxiliar.py"
Recursion Limit is set to 5000
Executing: pyinstaller --noconfirm --onedir --windowed C:/Users/User/Documents/Python/Scripts/Italiano/conjugacion_verbos_presente/auxiliar.py --distpath C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\application --workpath C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\build --specpath C:\Users\User\AppData\Local\Temp\tmp30rpmpfm
520727 INFO: PyInstaller: 3.6
520732 INFO: Python: 3.7.6 (conda)
520736 INFO: Platform: Windows-10-10.0.18362-SP0
520746 INFO: wrote C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\auxiliar.spec
520753 INFO: UPX is not available.
520761 INFO: Extending PYTHONPATH with paths
['C:\\Users\\User\\Documents\\Python\\Scripts\\Italiano',
'C:\\Users\\User\\AppData\\Local\\Temp\\tmp30rpmpfm']
520765 INFO: checking Analysis
520769 INFO: Building Analysis because Analysis-01.toc is non existent
520774 INFO: Reusing cached module dependency graph...
520878 INFO: Caching module graph hooks...
521005 INFO: running Analysis Analysis-01.toc
521011 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by C:\Anaconda3\python.exe
521620 INFO: Analyzing C:\Users\User\Documents\Python\Scripts\Italiano\conjugacion_verbos_presente\auxiliar.py
527431 INFO: Processing pre-find module path hook distutils
527438 INFO: distutils: retargeting to non-venv dir 'C:\\Anaconda3\\lib'
533043 INFO: Processing pre-safe import module hook setuptools.extern.six.moves
534572 INFO: Processing pre-find module path hook site
534577 INFO: site: retargeting to fake-dir 'C:\\Anaconda3\\lib\\site-packages\\PyInstaller\\fake-modules'
547576 INFO: Processing module hooks...
547582 INFO: Loading module hook "hook-distutils.py"...
547591 INFO: Loading module hook "hook-encodings.py"...
547763 INFO: Loading module hook "hook-importlib_metadata.py"...
547772 INFO: Loading module hook "hook-lib2to3.py"...
547785 INFO: Loading module hook "hook-numpy.core.py"...
An error occurred while packaging
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\Anaconda3\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\Anaconda3\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
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:\Anaconda3\lib\pkgutil.py", line 493, in find_loader
spec = importlib.util.find_spec(fullname)
File "C:\Anaconda3\lib\importlib\util.py", line 94, in find_spec
parent = __import__(parent_name, fromlist=['__path__'])
File "C:\Anaconda3\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:`enter code here`
1. Check that you expected to use Python3.7 from "C:\Anaconda3\python.exe",`enter code here`
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: 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:\Anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 320, in get_module_file_attribute
loader = pkgutil.find_loader(package)
File "C:\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'>:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from "C:\Anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: 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\User\Desktop\auto-py-to-exe-master\auto_py_to_exe\packaging.py", line 131, in package
run_pyinstaller()
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
exec(code, spec_namespace)
File "C:\Users\User\AppData\Local\Temp\tmp30rpmpfm\auxiliar.spec", line 17, in <module>
noarchive=False)
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 244, in __init__
self.__postinit__()
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 422, in assemble
self.graph.process_post_graph_hooks()
File "C:\Anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 311, in process_post_graph_hooks
module_hook.post_graph()
File "C:\Anaconda3\lib\site-packages\PyInstaller\depend\imphook.py", line 417, in post_graph
self._load_hook_module()
File "C:\Anaconda3\lib\site-packages\PyInstaller\depend\imphook.py", line 384, in _load_hook_module
self.hook_module_name, self.hook_filename)
File "C:\Anaconda3\lib\site-packages\PyInstaller\compat.py", line 797, in importlib_load_source
return mod_loader.load_module()
File "<frozen importlib._bootstrap_external>", line 407, in _check_name_wrapper
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:\Anaconda3\lib\site-packages\PyInstaller\hooks\hook-numpy.core.py", line 29, in <module>
pkg_base, pkg_dir = get_package_paths('numpy.core')
File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 537, in get_package_paths
file_attr = get_module_file_attribute(package)
File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\hooks\__init__.py", line 339, in get_module_file_attribute
raise ImportError
ImportError
Project output will not be moved to output folder
Complete.
Convert .py to .exe
Install auto-py-to-exe library
pip install auto-py-to-exe
Run the following command to convert .py to .exe
python -m auto_py_to_exe first.py
Follow the instructions
I installed pyinstaller through python -m pip install command. For a reason, pip is not in my path so that's how I did it. Then, it downloads pyinstaller and it gives me a warning that it's not in the path.
I ignore it and proceed to transform the directory where my project is. I wait a few moments and then if shows me this error message:
the cmd window error
C:\Users\dhiaa>pyinstaller echecs
88 INFO: PyInstaller: 3.6
89 INFO: Python: 3.8.1
89 INFO: Platform: Windows-10-10.0.17763-SP0
92 INFO: wrote C:\Users\dhiaa\echecs.spec
93 INFO: UPX is not available.
95 INFO: Extending PYTHONPATH with paths
['C:\\Users\\dhiaa', 'C:\\Users\\dhiaa']
96 INFO: checking Analysis
96 INFO: Building Analysis because Analysis-00.toc is non existent
96 INFO: Initializing module dependency graph...
100 INFO: Caching module graph hooks...
111 INFO: Analyzing base_library.zip ...
5848 INFO: Processing pre-find module path hook distutils
5850 INFO: distutils: retargeting to non-venv dir 'c:\\users\\dhiaa\\lib'
9865 INFO: Caching module dependency graph...
10167 INFO: running Analysis Analysis-00.toc
10172 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\dhiaa\python.exe
10332 INFO: Analyzing C:\Users\dhiaa\echecs
Traceback (most recent call last):
File "c:\users\dhiaa\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\dhiaa\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\dhiaa\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\users\dhiaa\lib\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\dhiaa\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\dhiaa\lib\site-packages\PyInstaller\building\build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\dhiaa\lib\site-packages\PyInstaller\building\build_main.py", line 681, in build
exec(code, spec_namespace)
File "C:\Users\dhiaa\echecs.spec", line 6, in <module>
a = Analysis(['echecs'],
File "c:\users\dhiaa\lib\site-packages\PyInstaller\building\build_main.py", line 244, in __init__
self.__postinit__()
File "c:\users\dhiaa\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "c:\users\dhiaa\lib\site-packages\PyInstaller\building\build_main.py", line 416, in assemble
priority_scripts.append(self.graph.run_script(script))
File "c:\users\dhiaa\lib\site-packages\PyInstaller\depend\analysis.py", line 249, in run_script
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "c:\users\dhiaa\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1391, in run_script
with open(pathname, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\dhiaa\\echecs'
> PermissionError: [Errno 13] Permission denied
I have a folder containing all my python files, it's not only one python file.
I used git on the main file of my project. Could it affect its accesibility? I also tried just to copy paste the entire project to some other places and the same permission error appears in cmd (even when in admin mode).
Can you do it again in a CMD opened as administrator?
Can you find c:\users\dhiaa\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py on disk?
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
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.
I have created one project in django.I have created installer for it using pyinstaller.If I run project using python manage.py runserver then project is running fine without any error,but I am not able to run it through installer. I am getting error while running installer.
C:\The_Incredibles\Pyinstaller Story\test_proj>.\dist\demo\demo.exe runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper
at 0x03A15978>
Traceback (most recent call last):
File "site-packages\django-1.10.4-py3.5.egg\django\utils\autoreload.py", line
226, in wrapper
File "site-packages\django-1.10.4-py3.5.egg\django\core\management\commands\ru
nserver.py", line 113, in inner_run
File "site-packages\django-1.10.4-py3.5.egg\django\utils\autoreload.py", line
249, in raise_last_exception
File "site-packages\django-1.10.4-py3.5.egg\django\utils\six.py", line 685, in
reraise
File "site-packages\django-1.10.4-py3.5.egg\django\utils\autoreload.py", line
226, in wrapper
File "site-packages\django-1.10.4-py3.5.egg\django\__init__.py", line 27, in s
etup
File "site-packages\django-1.10.4-py3.5.egg\django\apps\registry.py", line 85,
in populate
File "site-packages\django-1.10.4-py3.5.egg\django\apps\config.py", line 116,
in create
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'django.contrib.admin.apps'
demo.spec
# -*- mode: python -*-
block_cipher = None
a = Analysis(['test1\\manage.py'],
pathex=['C:\\The_Incredibles\\Pyinstaller Story\\test_proj'],
binaries=None,
datas=None,
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='demo',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='demo')
Here is PyInstaller log
(Sample) C:\The_Incredibles\Pyinstaller Story\test_proj>pyinstaller --name=demo
test1/manage.py
155 INFO: PyInstaller: 3.2
155 INFO: Python: 3.5.2
155 INFO: Platform: Windows-7-6.1.7601-SP1
157 INFO: wrote C:\The_Incredibles\Pyinstaller Story\test_proj\demo.spec
159 INFO: UPX is not available.
168 INFO: Extending PYTHONPATH with paths
['C:\\The_Incredibles\\Pyinstaller Story\\test_proj\\test1',
'C:\\The_Incredibles\\Pyinstaller Story\\test_proj']
168 INFO: checking Analysis
169 INFO: Building Analysis because out00-Analysis.toc is non existent
169 INFO: Initializing module dependency graph...
172 INFO: Initializing module graph hooks...
175 INFO: Analyzing base_library.zip ...
2829 INFO: running Analysis out00-Analysis.toc
2943 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-math-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3431 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-runtime-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3438 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-locale-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3445 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-heap-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3472 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-stdio-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3481 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-process-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3506 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-string-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3519 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-time-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3525 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-environment-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3545 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-convert-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3552 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-conio-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3564 WARNING: Can not get binary dependencies for file: C:\windows\system32\api-
ms-win-crt-filesystem-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
3567 INFO: Caching module hooks...
3572 INFO: Analyzing C:\The_Incredibles\Pyinstaller Story\test_proj\test1\manage
.py
6478 INFO: Loading module hooks...
6478 INFO: Loading module hook "hook-django.core.management.py"...
7684 INFO: Import to be excluded not found: 'matplotlib'
7685 INFO: Import to be excluded not found: 'tkinter'
7685 INFO: Excluding import 'IPython'
7688 WARNING: Removing import django.core.management.commands.shell from modul
e IPython
7689 WARNING: Removing import django.core.management.commands.shell from modul
e IPython.start_ipython
7689 WARNING: Removing import django.core.management.commands.shell from modul
e IPython.IPShell
7691 INFO: Loading module hook "hook-xml.py"...
7693 INFO: Loading module hook "hook-django.py"...
7694 INFO: Django root directory C:\The_Incredibles\Pyinstaller Story\test_proj\
test1\test1
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\utils\hooks\subpr
oc\django_import_finder.py", line 37, in <module>
list(settings.TEMPLATE_LOADERS) + \
File "c:\python\scripts\sample\lib\site-packages\django-1.10.4-py3.5.egg\djang
o\conf\__init__.py", line 54, in __getattr__
return getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'TEMPLATE_CONTEXT_PROCESSORS'
8910 INFO: Collecting Django migration scripts.
9818 INFO: Loading module hook "hook-django.core.mail.py"...
9880 INFO: Loading module hook "hook-encodings.py"...
9891 INFO: Loading module hook "hook-django.core.cache.py"...
9916 INFO: Loading module hook "hook-django.db.backends.py"...
10392 WARNING: Hidden import "django.db.backends.__pycache__.base" not found!
10393 INFO: Loading module hook "hook-pydoc.py"...
10395 INFO: Loading module hook "hook-xml.dom.domreg.py"...
10396 INFO: Loading module hook "hook-django.db.backends.oracle.base.py"...
10400 INFO: Loading module hook "hook-django.db.backends.mysql.base.py"...
10403 INFO: Loading module hook "hook-sqlite3.py"...
10478 INFO: checking Tree
10478 INFO: Building Tree because out00-Tree.toc is non existent
10479 INFO: Building Tree out00-Tree.toc
10969 INFO: Looking for ctypes DLLs
10986 INFO: Analyzing run-time hooks ...
10996 INFO: Including run-time hook 'pyi_rth_django.py'
11017 INFO: Looking for dynamic libraries
12997 WARNING: Can not get binary dependencies for file: C:\windows\system32\api
-ms-win-crt-utility-l1-1-0.dll
Traceback (most recent call last):
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 695, in getImports
return _getImports_pe(pth)
File "c:\python\scripts\sample\lib\site-packages\PyInstaller\depend\bindepend.
py", line 122, in _getImports_pe
dll, _ = sym.forwarder.split('.')
TypeError: a bytes-like object is required, not 'str'
12998 INFO: Looking for eggs
12999 INFO: Using Python library c:\python\scripts\sample\scripts\python35.dll
12999 INFO: Found binding redirects:
[]
13018 INFO: Warnings written to C:\The_Incredibles\Pyinstaller Story\test_proj\b
uild\demo\warndemo.txt
13157 INFO: checking PYZ
13158 INFO: Building PYZ because out00-PYZ.toc is non existent
13158 INFO: Building PYZ (ZlibArchive) C:\The_Incredibles\Pyinstaller Story\test
_proj\build\demo\out00-PYZ.pyz
14732 INFO: checking PKG
14732 INFO: Building PKG because out00-PKG.toc is non existent
14733 INFO: Building PKG (CArchive) out00-PKG.pkg
14784 INFO: Bootloader c:\python\scripts\sample\lib\site-packages\PyInstaller\bo
otloader\Windows-32bit\run.exe
14785 INFO: checking EXE
14785 INFO: Building EXE because out00-EXE.toc is non existent
14785 INFO: Building EXE from out00-EXE.toc
14786 INFO: Appending archive to EXE C:\The_Incredibles\Pyinstaller Story\test_p
roj\build\demo\demo.exe
14807 INFO: checking COLLECT
14808 INFO: Building COLLECT because out00-COLLECT.toc is non existent
14808 INFO: Building COLLECT out00-COLLECT.toc
(Sample) C:\The_Incredibles\Pyinstaller Story\test_proj>
My issue get resolved. The problem was pyinstaller not able to import all hidden imports.What I did I added one hookfile(hook-django.contrib.py) under Lib\site-packages\PyInstaller\hooks.
added following code to hookfile
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2016, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
from PyInstaller.utils.hooks import collect_submodules
hiddenimports = collect_submodules('django.contrib')
This worked for Me.
I have created exe file from my djnago project using pyinstaller and I am able to run my project using exe.
output after running exe file
(DemoEnv) C:\The_Incredibles\Pyinstaller Story\test_project>dist\manage\manage.e
xe runserver
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you
apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
December 29, 2016 - 10:45:08
Django version 1.10.4, using settings 'demo.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[29/Dec/2016 10:45:26] "GET / HTTP/1.1" 200 1767