1

I am new to Python, just installed Python 3.9.1 and PyCharm IDE community edition (I have a license for IntelliJ). I created my first project "Hello World" program in a project name "test1" which has 1 file main.py:

print("Hello World")
input()

I opened a command-line (cmd.exe) with Administrator permissions and run pip install pyinstaller to install pyInstaller, then navigated to my project d:\development\PyCharmProjects\pythonProject\test1 and run pyinstaller main.py build to create and executable file (main.exe).

The building FAILS with PermissionError: [Errno 13] Permission denied: 'D:\\development\\PycharmProjects\\pythonProject\\test1\\build'

here is the log of the build:

D:\development\PycharmProjects\pythonProject\test1>pyinstaller main.py build
52 INFO: PyInstaller: 4.2
52 INFO: Python: 3.9.1
53 INFO: Platform: Windows-10-10.0.19041-SP0
54 INFO: wrote D:\development\PycharmProjects\pythonProject\test1\main.spec
57 INFO: UPX is not available.
58 INFO: Extending PYTHONPATH with paths
    ['D:\\development\\PycharmProjects\\pythonProject\\test1',
     'D:\\development\\PycharmProjects\\pythonProject\\test1',
     'D:\\development\\PycharmProjects\\pythonProject\\test1']
63 INFO: checking Analysis
64 INFO: Building Analysis because Analysis-00.toc is non existent
64 INFO: Initializing module dependency graph...
65 INFO: Caching module graph hooks...
70 WARNING: Several hooks defined for module 'win32ctypes.core'. Please 
    take care they do not conflict.
74 INFO: Analyzing base_library.zip ...
2163 INFO: Processing pre-find module path hook distutils from 
    'd:\\devtools\\python\\python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
2164 INFO: distutils: retargeting to non-venv dir 'd:\\devtools\\python\\python39\\lib'
3793 INFO: Caching module dependency graph...
3884 INFO: running Analysis Analysis-00.toc
3886 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by d:\devtools\python\python39\python.exe
3935 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of d:\devtools\python\python39\python39.dll
3968 INFO: Analyzing D:\development\PycharmProjects\pythonProject\test1\main.py
3970 INFO: Analyzing D:\development\PycharmProjects\pythonProject\test1\build
Traceback (most recent call last):
  File "d:\devtools\python\python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\devtools\python\python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\devtools\Python\Python39\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "d:\devtools\python\python39\lib\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "d:\devtools\python\python39\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "d:\devtools\python\python39\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 "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
    exec(code, spec_namespace)
  File "D:\development\PycharmProjects\pythonProject\test1\main.spec", line 6, in <module>
    a = Analysis(['main.py', 'build'],
  File "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
    self.__postinit__()
  File "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "d:\devtools\python\python39\lib\site-packages\PyInstaller\building\build_main.py", line 414, in assemble
    priority_scripts.append(self.graph.run_script(script))
  File "d:\devtools\python\python39\lib\site-packages\PyInstaller\depend\analysis.py", line 320, in run_script
    return super(PyiModuleGraph, self).run_script(
  File "d:\devtools\python\python39\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1407, in run_script
    with open(pathname, 'rb') as fp:
PermissionError: [Errno 13] Permission denied: 'D:\\development\\PycharmProjects\\pythonProject\\test1\\build'

I am using:

  • Windows 10 Home,
  • Python 3.9.1
  • PyCharm 2020.3 Community Edition
  • pyinstaller 4.2

PermissionError: [Errno 13] Permission denied

PermissionError: [Errno 13] in python

PermissionError: [Errno 13] Permission denied: pyinstaller.exe/TKinter

I tried to do it without the build, and the executable main.exe was created, but when I run it I get another error: Missing python39.dll when running executable

What am I doing wrong? Am I creating the executable correctly? I would appreciate any assistance.

Binyamin Regev
  • 914
  • 5
  • 19
  • 31

0 Answers0