I am trying to install use pyinstaller to turn all my scripts into an exe file. I am just using auto-py-to-exe which I believe uses pyinstaller under the hood.
However, I've come across this issue:
Traceback (most recent call last):
File "importlib_metadata\__init__.py", line 409, in from_name
StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "pikepdf\__init__.py", line 16, in <module>
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "pikepdf\_version.py", line 11, in <module>
File "importlib_metadata\__init__.py", line 910, in version
File "importlib_metadata\__init__.py", line 883, in distribution
File "importlib_metadata\__init__.py", line 411, in from_name
importlib_metadata.PackageNotFoundError: No package metadata was found for pikepdf
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "scheduling_master.py", line 18, in <module>
import resume_pkg
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "resume_pkg.py", line 12, in <module>
import pikepdf
File "PyInstaller\loader\pyimod02_importers.py", line 352, in exec_module
File "pikepdf\__init__.py", line 18, in <module>
ImportError: Failed to determine version
This only happens AFTER I open the executable. Turning it into an executable has no errors. Furthermore, if I run the scripts stand-alone it has no import error and lets me run it without error. How would I go about fixing this? I've tried reinstalling / installing other versions. Right now I have auto-py-to-exe as version 2.35.0 and pikepdf as version 5.4.2
In auto-py-to-exe
after entering the script and selecting all the options that you have checked in previous attempts, click on the "advanced" dropdown, then find the option that says --recursive-copy-metadata
and click the "+"
button. Then inside of the edit box enter pikepdf
and then click the convert button at the bottom, and that should solve your issue.
ALternatively, use pyinstaller and add the following to the CLI args.
--recursive-copy-metadata pikepdf