pyinstaller permission denied: C:\Python\Scripts\build - python

I'm getting this error when I try to build my python script to exe file.
This is my script:
from tkinter import *
import os
import tkinter.messagebox
root = Tk()
root.title('BTCLoot - Loot BTC from your home!')
logoutButton = Button(root, text='Logout')
logoutButton.grid(row=0, column=0, sticky=W)
balance = Label(text='Balance: N/A Sat.')
balance.grid(row=0, column=1, sticky=W)
root.geometry('600x250')
root.mainloop()
and this is what I get in console:
C:\Python34\Scripts>pyinstaller btcloot.py build
109 INFO: PyInstaller: 3.3
109 INFO: Python: 3.6.2
109 INFO: Platform: Windows-8.1-6.3.9600-SP0
109 INFO: wrote C:\Python34\Scripts\btcloot.spec
109 INFO: UPX is not available.
109 INFO: Extending PYTHONPATH with paths
['C:\\Python34\\Scripts', 'C:\\Python34\\Scripts', 'C:\\Python34\\Scripts']
109 INFO: checking Analysis
109 INFO: Building Analysis because out00-Analysis.toc is non existent
109 INFO: Initializing module dependency graph...
109 INFO: Initializing module graph hooks...
125 INFO: Analyzing base_library.zip ...
5109 INFO: running Analysis out00-Analysis.toc
5109 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies o
inal executable
required by c:\python34\python.exe
6093 INFO: Caching module hooks...
6109 INFO: Analyzing C:\Python34\Scripts\btcloot.py
6328 INFO: Analyzing C:\Python34\Scripts\build
Traceback (most recent call last):
File "C:\Python34\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.3', 'console_scripts', 'pyinstaller')()
File "c:\python34\lib\site-packages\PyInstaller\__main__.py", line 92, in r
run_build(pyi_config, spec_file, **vars(args))
File "c:\python34\lib\site-packages\PyInstaller\__main__.py", line 46, in r
build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_bui
))
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
213, in __init__
self.__postinit__()
File "c:\python34\lib\site-packages\PyInstaller\building\datastruct.py", li
161, in __postinit__
self.assemble()
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
415, in assemble
priority_scripts.append(self.graph.run_script(script))
File "c:\python34\lib\site-packages\PyInstaller\depend\analysis.py", line 2
in run_script
return super(PyiModuleGraph, self).run_script(pathname, caller=caller)
File "c:\python34\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph
", line 1326, in run_script
with open(pathname, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'C:\\Python34\\Scripts\\build'
C:\Python34\Scripts>pyinstaller btcloot.py build
103 INFO: PyInstaller: 3.3
104 INFO: Python: 3.6.2
104 INFO: Platform: Windows-8.1-6.3.9600-SP0
106 INFO: wrote C:\Python34\Scripts\btcloot.spec
107 INFO: UPX is not available.
109 INFO: Extending PYTHONPATH with paths
['C:\\Python34\\Scripts', 'C:\\Python34\\Scripts', 'C:\\Python34\\Scripts']
110 INFO: checking Analysis
110 INFO: Building Analysis because out00-Analysis.toc is non existent
110 INFO: Initializing module dependency graph...
113 INFO: Initializing module graph hooks...
116 INFO: Analyzing base_library.zip ...
5156 INFO: running Analysis out00-Analysis.toc
5156 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies o
inal executable
required by c:\python34\python.exe
6156 INFO: Caching module hooks...
6171 INFO: Analyzing C:\Python34\Scripts\btcloot.py
6406 INFO: Analyzing C:\Python34\Scripts\build
Traceback (most recent call last):
File "C:\Python34\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.3', 'console_scripts', 'pyinstaller')()
File "c:\python34\lib\site-packages\PyInstaller\__main__.py", line 92, in r
run_build(pyi_config, spec_file, **vars(args))
File "c:\python34\lib\site-packages\PyInstaller\__main__.py", line 46, in r
build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_bui
))
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
213, in __init__
self.__postinit__()
File "c:\python34\lib\site-packages\PyInstaller\building\datastruct.py", li
161, in __postinit__
self.assemble()
File "c:\python34\lib\site-packages\PyInstaller\building\build_main.py", li
415, in assemble
priority_scripts.append(self.graph.run_script(script))
File "c:\python34\lib\site-packages\PyInstaller\depend\analysis.py", line 2
in run_script
return super(PyiModuleGraph, self).run_script(pathname, caller=caller)
File "c:\python34\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph
", line 1326, in run_script
with open(pathname, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'C:\\Python34\\Scripts\\build'
Can someone help me? I'm new to pyinstaller.
Also, when I try to use py2exe, it does not compile it for me.

I've fixed it:
pyinstaller -F btcloot.py

Related

Pyinstaller throwing AttributeError: 'NoneType' object has no attribute 'groups' error

I am trying to create a simple standalone script with pyinstaller. The script only uses pandas and pdfminer packages. I have also created a fresh environment with only these two packages and their dependencies installed.
I get the below error when running pyinstaller --onefile ema_pdf_reader.spec and my .spec file looks like this:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['ema_pdf_reader.py'],
pathex=['/home/erik/PycharmProjects/simple_gui'],
binaries=[],
datas=[],
hiddenimports=['pandas','pdfminer'],
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,
a.binaries,
a.zipfiles,
a.datas,
[],
name='ema_pdf_reader',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
ERROR:
(clean_env) [erik#liara simple_gui]$ pyinstaller --onefile ema_pdf_reader.spec
34 INFO: PyInstaller: 3.6
34 INFO: Python: 3.8.2 (conda)
69 INFO: Platform: Linux-5.10.15-1-MANJARO-x86_64-with-glibc2.10
72 INFO: UPX is not available.
73 INFO: Extending PYTHONPATH with paths
['/home/erik/PycharmProjects/simple_gui',
'/home/erik/PycharmProjects/simple_gui']
73 INFO: checking Analysis
73 INFO: Building Analysis because Analysis-00.toc is non existent
73 INFO: Initializing module dependency graph...
74 INFO: Caching module graph hooks...
78 INFO: Analyzing base_library.zip ...
2247 INFO: Processing pre-find module path hook distutils
2247 INFO: distutils: retargeting to non-venv dir '/home/erik/miniconda3/envs/clean_env/lib/python3.8'
4327 INFO: Caching module dependency graph...
4424 INFO: running Analysis Analysis-00.toc
4448 INFO: Analyzing ema_pdf_reader.py
5378 INFO: Processing pre-safe import module hook six.moves
6929 INFO: Processing pre-find module path hook site
6929 INFO: site: retargeting to fake-dir '/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/fake-modules'
12802 INFO: Processing module hooks...
12802 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
12803 INFO: Loading module hook "hook-numpy.py"...
12803 INFO: Loading module hook "hook-pytz.py"...
12816 INFO: Loading module hook "hook-pandas.py"...
13457 INFO: Loading module hook "hook-distutils.py"...
13459 INFO: Loading module hook "hook-pkg_resources.py"...
13672 INFO: Processing pre-safe import module hook win32com
13879 WARNING: Hidden import "pkg_resources.py2_warn" not found!
13881 INFO: Excluding import '__main__'
13882 INFO: Removing import of __main__ from module pkg_resources
13883 INFO: Loading module hook "hook-pydoc.py"...
13883 INFO: Loading module hook "hook-_tkinter.py"...
13974 INFO: checking Tree
13979 INFO: checking Tree
13983 INFO: Loading module hook "hook-sysconfig.py"...
13993 INFO: Loading module hook "hook-cryptography.py"...
14149 INFO: Loading module hook "hook-setuptools.py"...
14570 INFO: Loading module hook "hook-encodings.py"...
14619 INFO: Loading module hook "hook-lib2to3.py"...
14621 INFO: Loading module hook "hook-sqlite3.py"...
14665 INFO: Loading module hook "hook-numpy.core.py"...
14666 INFO: MKL libraries found when importing numpy. Adding MKL to binaries
14667 INFO: Loading module hook "hook-xml.py"...
14790 INFO: Looking for ctypes DLLs
Traceback (most recent call last):
File "/home/erik/miniconda3/envs/clean_env/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 681, in build
exec(code, spec_namespace)
File "ema_pdf_reader.spec", line 6, in <module>
a = Analysis(['ema_pdf_reader.py'],
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 244, in __init__
self.__postinit__()
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/datastruct.py", line 160, in __postinit__
self.assemble()
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 440, in assemble
ctypes_binaries = scan_code_for_ctypes(co)
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/depend/utils.py", line 143, in scan_code_for_ctypes
binaries = _resolveCtypesImports(binaries)
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/depend/utils.py", line 317, in _resolveCtypesImports
load_ldconfig_cache()
File "/home/erik/miniconda3/envs/clean_env/lib/python3.8/site-packages/PyInstaller/depend/utils.py", line 400, in load_ldconfig_cache
path = m.groups()[-1]
AttributeError: 'NoneType' object has no attribute 'groups'
Do I need to specify some other settings in my .spec file? So far I just added external packages to hiddenimports, rest of the .spec file was auto generated with pyi-makespec --onefile ema_pdf_reader.py
Script by it self runs fine and creating standalone scripts that only use standard libraries also works with no problem.
UPDATE 1:
The error must be due to ctype DLL detection. It happens when importing numpy as well. I have tried with different versions of pyinstaller (3.6 and 4.2) and the error persists. I also tried reinstalling pyinstaller with pip instead of conda and it didn't help.
UPDATE 2:
Executing same procedure on a windows machine works as expected
It seems here (https://github.com/pyinstaller/pyinstaller/issues/5552) they found something similar. Their setup is quite similar to mine. Still reading...
EDIT 1:
I finally made it work. Had to:
1.-edit manually file "utils.py" and add the missing condition
2.-reinstall my version of Python (3.7.4) with shared libraries enabled
Still have to test the final result.
I was getting a similar error. See my error below.
What worked for me was to upgrade to PyInstaller 4.8.
Older versions of PyInstaller had an issue inside of utils.py. Specifically, if path was ever None at approximately line 401 in utils.py, the subsequent code failed. This has been corrected in newer versions of PyInstaller.
My Error Message
$ pyinstaller perform_optimization.spec
[...]
Cache generated by: ldconfig (Ubuntu GLIBC 2.35-0ubuntu3.1) stable release version 2.35
Traceback (most recent call last):
File "/home/strawberry/anaconda3/envs/python-app/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 681, in build
exec(code, spec_namespace)
File "perform_optimization.spec", line 45, in <module>
noarchive=False)
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 244, in __init__
self.__postinit__()
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/building/datastruct.py", line 160, in __postinit__
self.assemble()
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/building/build_main.py", line 440, in assemble
ctypes_binaries = scan_code_for_ctypes(co)
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/depend/utils.py", line 143, in scan_code_for_ctypes
binaries = _resolveCtypesImports(binaries)
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/depend/utils.py", line 317, in _resolveCtypesImports
load_ldconfig_cache()
File "/home/strawberry/anaconda3/envs/python-app/lib/python3.7/site-packages/PyInstaller/depend/utils.py", line 401, in load_ldconfig_cache
path = m.groups()[-1]
AttributeError: 'NoneType' object has no attribute 'groups'

Pyinstaller not building correctly with PyQt5

I've been trying to build a project using pyinstaller. The project is using PyQt5 and I'm not able to build it correctly. UPX and python are in my PATH. I don't want to mess with any of the package python files so I'm not sure what to do. Here is the cmd output:
C:\Users\John\Desktop\Project_Convar\LarkEnv>pyinstaller -F myProject.py
60 INFO: PyInstaller: 3.5.dev0+cb8d10af6
61 INFO: Python: 3.6.2
62 INFO: Platform: Windows-10-10.0.17134-SP0
64 INFO: wrote C:\Users\John\Desktop\Project_Convar\LarkEnv\myProject.spec
428 INFO: UPX is available.
429 INFO: Extending PYTHONPATH with paths
['C:\\Users\\John\\Desktop\\Project_Convar\\LarkEnv',
'C:\\Users\\John\\Desktop\\Project_Convar\\LarkEnv']
430 INFO: checking Analysis
461 INFO: checking PYZ
478 INFO: checking PKG
479 INFO: Building because toc changed
479 INFO: Building PKG (CArchive) PKG-00.pkg
483 INFO: Executing - upx --lzma -q
...
execute bunch of upx stuff
...
C:\Users\John\AppData\Roaming\pyinstaller\bincache01_py36_64bit\qt5svg.dll
27209 WARNING: One binary added with two internal names.
27209 WARNING: ('libGLESv2.dll',
'C:\\users\\John\\desktop\\project_convar\\larkenv\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
'BINARY')
27211 WARNING: was placed previously at
27211 WARNING: ('PyQt5\\Qt\\bin\\libGLESv2.dll',
'C:\\users\\John\\desktop\\project_convar\\larkenv\\lib\\site-packages\\PyQt5\\Qt\\bin\\libGLESv2.dll',
'BINARY')
C:\Users\John\AppData\Roaming\pyinstaller\bincache01_py36_64bit\qt5qml.dll
Traceback (most recent call last):
File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\John\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\John\AppData\Local\Programs\Python\Python36\Scripts\pyinstaller.exe\__main__.py", line 9, in <module>
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 111, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\__main__.py", line 63, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 844, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\build_main.py", line 791, in build
exec(code, spec_namespace)
File "C:\Users\John\Desktop\Project_Convar\LarkEnv\myProject.spec", line 32, in <module>
console=True )
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\api.py", line 430, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\api.py", line 196, in __init__
self.__postinit__()
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\datastruct.py", line 158, in __postinit__
self.assemble()
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\api.py", line 281, in assemble
pylib_name=pylib_name)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 334, in __init__
super(CArchiveWriter, self).__init__(archive_path, logical_toc)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 61, in __init__
self._add_from_table_of_contents(logical_toc)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 86, in _add_from_table_of_contents
self.add(toc_entry) # The guts of the archive.
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\archive\writers.py", line 375, in add
code = get_code_object(nm, pathnm)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\utils.py", line 623, in get_code_object
co = _load_code(modname, filename)
File "c:\users\John\appdata\local\programs\python\python36\lib\site-packages\PyInstaller\building\utils.py", line 580, in _load_code
loader = importer.find_module(modname)
AttributeError: 'NoneType' object has no attribute 'find_module'
I test and pyinstaller don't have any problem with PyQt5.
use this code in CMD:
pyinstaller --onefile myProject.py

pyinstaller 3.3.1 doesn't work with openpyxl 2.4.1

I have a large program I'm trying to package with pyinstaller and have discovered that the problem is the openpyxl package.
Here is a minimal program:
import openpyxl
print("Hello World")
Here is the command that I am using to run pyinstaller:
$ pyinstaller --onefile demo2.py
Here is the output:
$ pyinstaller --onefile demo2.py
461 INFO: PyInstaller: 3.3.1
461 INFO: Python: 3.6.0
470 INFO: Platform: Darwin-18.0.0-x86_64-i386-64bit
471 INFO: wrote /Users/user/gits/drb_rounder/python/demo2.spec
475 INFO: UPX is not available.
476 INFO: Extending PYTHONPATH with paths
['/Users/user/gits/drb_rounder/python',
'/Users/user/gits/drb_rounder/python']
476 INFO: checking Analysis
579 INFO: Building because /Users/user/gits/drb_rounder/python/demo2.py changed
579 INFO: Initializing module dependency graph...
585 INFO: Initializing module graph hooks...
587 INFO: Analyzing base_library.zip ...
4887 INFO: running Analysis out00-Analysis.toc
4898 INFO: Caching module hooks...
4902 INFO: Analyzing /Users/user/gits/drb_rounder/python/demo2.py
6692 INFO: Processing pre-find module path hook distutils
10268 INFO: Processing pre-find module path hook site
10269 INFO: site: retargeting to fake-dir '/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/fake-modules'
10296 INFO: Processing pre-safe import module hook win32com
12225 INFO: Processing pre-safe import module hook six.moves
23816 INFO: Processing pre-safe import module hook
requests.packages.urllib3.packages.six.moves
Traceback (most recent call last):
File "/Users/user/anaconda3/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
...
packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1576, in _find_head_package
target_module_headname, target_package_name, source_package)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/depend/analysis.py", line 271, in _safe_import_module
module_basename, module_name, parent_package)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1993, in _safe_import_module
module_name, file_handle, pathname, metadata)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2031, in _load_module
m = self._load_package(fqname, pathname, packagepath)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2789, in _load_package
ns_pkgpath = _namespace_package_path(fqname, pkgpath or [], self.path)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 147, in _namespace_package_path
working_set = pkg_resources.WorkingSet(path)
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 644, in __init__
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 700, in add_entry
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 1990, in find_on_path
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2399, in from_location
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2378, in __init__
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 1387, in safe_version
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/packaging/version.py", line 207, in __init__
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/packaging/version.py", line 207, in <genexpr>
RecursionError: maximum recursion depth exceeded while calling a Python object
$
It seems to me that openpyxl doesn't like it to get compiled:
When compiling the same code as you I get:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
However, there are other Modules for reading excel files like pyexcel (Haven't tried it though)
Another quite simple solution is to use the "xlrd" package instead of "openpyxl". It worked out very well for me.

Pyinstaller build process cannot locate pywintypes module

Recently updated my computer to Windows 10 and now pyinstaller is throwing an error. This has been working on my Windows 7 computer for as long as I can remember.
I have tried uninstalling and reinstalling pyinstaller, win32 extentions, and several other things.
Any ideas what could be wrong with my computer settings?
pyinstaller ZENTRAUtility.spec
328 INFO: PyInstaller: 3.3.1
328 INFO: Python: 2.7.14
328 INFO: Platform: Windows-10-10.0.16299
331 INFO: UPX is not available.
332 INFO: Extending PYTHONPATH with paths
['C:\\Users\\mthornbrugh\\PycharmProjects\\ZentraUtility',
'C:\\Users\\mthornbrugh\\PycharmProjects\\ZentraUtility']
332 INFO: checking Analysis
347 INFO: Building because out00-Analysis.toc is bad
348 INFO: Initializing module dependency graph...
351 INFO: Initializing module graph hooks...
430 INFO: running Analysis out00-Analysis.toc
431 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final
executable
required by c:\python27\python.exe
525 INFO: Found
...
...
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "c:\python27\lib\site-packages\PyInstaller\utils\win32\winutils.py",
line 103, in import_pywin32_module
name=module_name, globals={}, locals={}, fromlist=[''])
ImportError: No module named pywintypes
29585 INFO: Loading module hook "hook-setuptools.py"...
29631 INFO: Loading module hook "hook-PIL.SpiderImagePlugin.py"...
29634 INFO: Excluding import 'FixTk'
29635 INFO: Excluding import 'Tkinter'
29638 INFO: Loading module hook "hook-encodings.py"...
30174 INFO: Loading module hook "hook-reportlab.pdfbase._fontdata.py"...
30234 INFO: Loading module hook "hook-xml.etree.cElementTree.py"...
30236 INFO: Loading module hook "hook-numpy.core.py"...
30318 INFO: Loading module hook "hook-wx.lib.pubsub.py"...
30561 INFO: Loading module hook "hook-win32com.py"...
31109 INFO: Loading module hook "hook-pythoncom.py"...
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "c:\python27\lib\site-packages\PyInstaller\utils\win32\winutils.py",
line 103, in import_pywin32_module
name=module_name, globals={}, locals={}, fromlist=[''])
File "c:\python27\lib\site-packages\pythoncom.py", line 2, in <module>
import pywintypes
ImportError: No module named pywintypes
31572 INFO: Loading module hook "hook-reportlab.lib.utils.py"...
31630 INFO: Looking for ctypes DLLs
31723 INFO: Analyzing run-time hooks ...
31736 INFO: Including run-time hook 'pyi_rth__tkinter.py'
31739 INFO: Including run-time hook 'pyi_rth_pkgres.py'
31742 INFO: Including run-time hook 'pyi_rth_win32comgenpy.py'
31743 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
31773 INFO: Looking for dynamic libraries
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\pyinstaller.exe\__main__.py", line 9, in
<module>
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 94, in
run
run_build(pyi_config, spec_file, **vars(args))
File "c:\python27\lib\site-packages\PyInstaller\__main__.py", line 46, in
run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'),
kw.get('clean_build'))
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 737, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 213, in __init__
self.__postinit__()
File "c:\python27\lib\site-packages\PyInstaller\building\datastruct.py",
line 161, in __postinit__
self.assemble()
File "c:\python27\lib\site-packages\PyInstaller\building\build_main.py",
line 537, in assemble
redirects=self.binding_redirects))
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line
222, in Dependencies
for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line
400, in getAssemblyFiles
for assembly in getAssemblies(pth):
File "c:\python27\lib\site-packages\PyInstaller\depend\bindepend.py", line
351, in getAssemblies
res = GetManifestResources(pth)
File "c:\python27\lib\site-
packages\PyInstaller\utils\win32\winmanifest.py", line 1005, in
GetManifestResources
return winresource.GetResources(filename, [RT_MANIFEST], names,
languages)
File "c:\python27\lib\site-
packages\PyInstaller\utils\win32\winresource.py", line 168, in GetResources
hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
pywintypes.error: (1006, 'LoadLibraryEx', 'The volume for a file has been
externally altered so that the opened file is no longer valid.')
I have encountered the same issue. It was caused by Pyinstaller being very greedy when processing the files in the source directory, and as such it traversed and picked up things that were not suitable, e.g. subdirectories of frameworks, such as .git, or, in my case .vscode. This may results in some hard-to-debug issues - see https://stackoverflow.com/a/58195896/1603969.
I solved my problem by copying the source files to a clean directory and then producing a bundle from this clean directory where only necessary source files resided.

pyinstaller create binary from python3 file, error: AttributeError: 'NoneType' object has no attribute 'rfind'

I try to create python binary from python3 file with pyinstaller, but it failled and the error message as below, can anyone give me some suggestion? thanks.
user#user:~ /Pyinstaller3/pyinstaller-python3$ **python3.4 pyinstaller.py -F /home/austinlin/programTest/translate0918_1.py**
67 INFO: PyInstaller: 3.0.dev
67 INFO: Python: 3.4.3
67 INFO: Platform: Linux-3.2.0-90-generic-pae-i686-with-Ubuntu-12.04-precise
67 INFO: wrote /home/austinlin/tools/Pyinstaller3/pyinstaller-python3/translate0918_1/translate0918_1.spec
68 INFO: UPX is not available.
69 INFO: Extending PYTHONPATH with /home/austinlin/programTest
69 INFO: checking Analysis
76 INFO: checking PYZ
79 INFO: checking PKG
79 INFO: Building because toc changed
80 INFO: Building PKG (CArchive) out00-PKG.pkg
Traceback (most recent call last):
File "pyinstaller.py", line 18, in <module>
run()
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/__main__.py", line 99, in run
run_build(opts, spec_file, pyi_config)
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/__main__.py", line 47, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **opts.__dict__)
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/building/build_main.py", line 734, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/building/build_main.py", line 677, in build
exec(text, spec_namespace)
File "<string>", line 28, in <module>
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/building/api.py", line 421, in __init__
strip_binaries=self.strip, upx_binaries=self.upx,
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/building/api.py", line 232, in __init__
self.__postinit__()
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/building/datastruct.py", line 153, in __postinit__
self.assemble()
File "/home/austinlin/tools/Pyinstaller3/pyinstaller-python3/PyInstaller/building/api.py", line 300, in assemble
pylib_name = os.path.basename(bindepend.get_python_library_path())
File "/usr/lib/python3.4/posixpath.py", line 139, in basename
i = p.rfind(sep) + 1
AttributeError: 'NoneType' object has no attribute 'rfind'
But if I use python python2.7 pyinstaller.py -F python2file.py, it work fine

Categories

Resources