I tried to compile my python script into exe using pyinstaller. It came out successful. But when I try to run the exe file, it shows an error with parsedatetime module.
I'm using Python 3.8.3. Please help. Thank you very much.
Here is the error:
Traceback (most recent call last):
File "trendy.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "site-packages\parsedatetime\__init__.py", line 69, in <module>
File "site-packages\parsedatetime\__init__.py", line 69, in <listcomp>
File "site-packages\parsedatetime\pdt_locales\__init__.py", line 29, in load_locale
AttributeError: module 'parsedatetime.pdt_locales' has no attribute 'de_DE'
Related
When I compile my python code with pyinstaller, the "profanity_check" module gives an error:
Traceback (most recent call last):
File "main.py", line 6, in <module>
from profanity_check import predict, predict_prob
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "profanity_check\__init__.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 493, in exec_module
File "profanity_check\profanity_check.py", line 6, in <module>
File "joblib\numpy_pickle.py", line 579, in load
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\MyPc\\AppData\\Local\\Temp\\_MEI67002\\profanity_check\\data\\vectorizer.joblib'
[8696] Failed to execute script 'main' due to unhandled exception!
It is correct that there is no such file: vectorizer.joblib but when i run the uncompiled program it runs fine.
other modules get compiled without any problem.
I tested my app in vs code and ran my app fine . but when I export this app :
Traceback (most recent call last):
File "main.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 546, in exec_module
File "kivy\__init__.py", line 272, in <module>
File "C:\Users\0123m\AppData\Local\Programs\Python\Python39\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 71, in _pyi_pkgutil_iter_modules
assert pkg_path.startswith(SYS_PREFIX)
TypeError: startswith first arg must be str or a tuple of str, not PureWindowsPath
I exported this using the command that kivy provided
When I do pyinstaller it executes successfully for python 3.7.
But when I execute the resulting exe I get the result under.
How can I correct this?
dist>mainlocal.exe
Traceback (most recent call last):
File "SpeechChangerLocal\mainlocal.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "d:\home\gitrep\ttt\local\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\google\cloud\speech_v1\__init__.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "d:\home\gitrep\ttt\local\venv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
exec(bytecode, module.__dict__)
File "lib\site-packages\google\cloud\speech_v1\gapic\speech_client.py", line 41, in <module>
File "lib\site-packages\pkg_resources\__init__.py", line 481, in get_distribution
File "lib\site-packages\pkg_resources\__init__.py", line 357, in get_provider
File "lib\site-packages\pkg_resources\__init__.py", line 900, in require
File "lib\site-packages\pkg_resources\__init__.py", line 786, in resolve
pkg_resources.DistributionNotFound: The 'google-cloud-speech' distribution was not found and is required by the application
[2900] Failed to execute script mainlocal
I imported google-cloud-speech_v1 instead of google-cloud-speech. Now it works.
I found "When Things Go Wrong" in manual very informative:
so I have been using Pyinstaller the last couple of months to package and distribute my applications as single exe files, however I recently made the switch from using Tkinter in my GUI apps to using PySide2 (QT5 Wrapper). The thing is, I'm not able to package those executables, as I'm getting the following error at runtime:
Exception: [Errno 2] No such file or directory: 'C:\\support\\signature\\loader.py'
Traceback (most recent call last):
File "pyscript", line 23, in bootstrap
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\support\\signature\\loader.py'
AttributeError: module 'signature_loader' has no attribute 'pyside_type_init'
SystemError: could not initialize part 2
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "pkg_resources\__init__.py", line 33, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "platform.py", line 116, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "subprocess.py", line 50, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:\Users\felip\AppData\Roaming\Python\Python37\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.__dict__)
File "signal.py", line 45, in <module>
File "c:\program files\python37\lib\functools.py", line 54, in update_wrapper
value = getattr(wrapped, attr)
SystemError: <method-wrapper '__get__' of getset_descriptor object at 0x0000023A7ACE88B8> returned a result with an error set
[9240] Failed to execute script pyi_rth_pkgres
The package should consist of one .py file, one .uic QT file and a SQLite3 .db .
I have tried packaging with Pyinstaller in several ways, however the same exception arises when trying to execute the application.
I'm using Python 3.7.2, Pyinstaller 3.4, PySide 5.12.1 and peewee 3.9.2 .
Any help is greatly appreciated.
The following worked for me:
1. uninstalled pyinstaller and installed the developer version from git (but didn't change anything so far - maybe that's not necessary)
2. typed pyinstaller -v example.pyw
3. used the returned value from 2 as hidden import. In my case pyinstaller --hidden-import=4.0.dev0+869062597f example.pyw
I'm trying to classify my own images in tensorflow.
I have entered the following command to train my model:
python3 train.py --logstderr --train_dir=training/ --
pipeline_config_path=training/ssd_mobilenet_v1_pets.config
From tutorial https://youtu.be/JR8CmWyh2E8?t=757 time 12:38
and I get the following error:
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection.builders import model_builder
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/model_builder.py", line 17, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/anchor_generator_builder.py", line 20, in <module>
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 664, in _load_unlocked
File "<frozen importlib._bootstrap>", line 634, in _load_backward_compatible
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/protos/anchor_generator_pb2.py", line 27, in <module>
File "/usr/local/lib/python3.5/dist-packages/google/protobuf/descriptor.py", line 829, in _new_
return _message.default_pool.AddSerializedFile(serialized_pb)
TypeError: Couldn't build proto file into descriptor pool!
Invalid proto descriptor for file "object_detection/protos/anchor_generator.proto":
object_detection/protos/anchor_generator.proto: Import "object_detection/protos/grid_anchor_generator.proto" has not been loaded.
object_detection/protos/anchor_generator.proto: Import "object_detection/protos/ssd_anchor_generator.proto" has not been loaded.
object_detection.protos.AnchorGenerator.grid_anchor_generator: "object_detection.protos.GridAnchorGenerator" seems to be defined in "protos/grid_anchor_generator.proto", which is not imported by "object_detection/protos/anchor_generator.proto". To use it here, please add the necessary import.
object_detection.protos.AnchorGenerator.ssd_anchor_generator: "object_detection.protos.SsdAnchorGenerator" seems to be defined in "protos/ssd_anchor_generator.proto", which is not imported by "object_detection/protos/anchor_generator.proto". To use it here, please add the necessary import.
What have I done wrong? Thanks in advance.
Update:
I now get this error:
Traceback (most recent call last):
File "train.py", line 51, in <module>
from object_detection.builders import model_builder
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/model_builder.py", line 17, in <module>
File "/usr/local/lib/python3.5/dist-packages/object_detection-0.1-py3.5.egg/object_detection/builders/anchor_generator_builder.py", line 20, in <module>
ImportError: cannot import name 'anchor_generator_pb2'