Missing Modules message while compiling a program using py2exe

79 Views Asked by At

I am attempting to take a program I created and turn it into an executable. It is not a fancy program at all and I believe I should be able to bundle all the dependencies into the executable to make distribution easier. The executable is produced, but when I try to run it I get the message

C:\Users\chadd\OneDrive\Desktop\parser>Parser_002.exe
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = 'C:\Users\chadd\OneDrive\Desktop\parser\Parser_002.exe'
  isolated = 1
  environment = 0
  user site = 0
  import site = 0
  sys._base_executable = 'C:\\Users\\chadd\\OneDrive\\Desktop\\parser\\Parser_002.exe'
  sys.base_prefix = ''
  sys.base_exec_prefix = ''
  sys.platlibdir = 'lib'
  sys.executable = 'C:\\Users\\chadd\\OneDrive\\Desktop\\parser\\Parser_002.exe'
  sys.prefix = ''
  sys.exec_prefix = ''
  sys.path = [
    'C:\\Users\\chadd\\OneDrive\\Desktop\\parser\\library.zip',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x000000e0 (most recent call first):
  <no Python frame>

Here is the message I receive in the command prompt window when executing the compile:

C:\Users\chadd\OneDrive\Desktop\parser>python setup.py py2exe
C:\Users\chadd\OneDrive\Desktop\parser\setup.py:7: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  from distutils.core import setup
running py2exe

  13 missing Modules
  ------------------
? __main__                            imported from bdb, pdb
? _frozen_importlib                   imported from importlib, importlib.abc, zipimport
? _frozen_importlib_external          imported from importlib, importlib._bootstrap, importlib.abc, zipimport
? _posixshmem                         imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
? _winreg                             imported from platform
? asyncio.DefaultEventLoopPolicy      imported from -
? dummy.Process                       imported from multiprocessing.pool
? java.lang                           imported from platform
? org.python.core                     imported from copy, pickle
? os.path                             imported from ctypes._aix, distutils.file_util, os, pkgutil, py_compile, sysconfig, tracemalloc, unittest, unittest.util
? pep517                              imported from importlib.metadata
? readline                            imported from cmd, code, pdb
? resource                            imported from test.support
Building 'dist\Parser_002.exe'.
Building shared code archive 'dist\library.zip'.

Here is the setup.py script I am using:

from distutils.core import setup
import py2exe
 
setup(console=['Parser_002.py'],options={"py2exe": {"unbuffered": True,"optimize": 2,"bundle_files": 0,"compressed": False,"includes": [],"excludes" : [],"packages": [],"dll_excludes": []}})

I have tried checking the python path to ensure that the path points to the directories where all the python libraries and modules are located. Everything seems correct there.

I have tried compiling the program without bundling and it will compile and properly execute as long as the executable is still in a directory with all the other ./dist files that get generated by py2exe

0

There are 0 best solutions below