I compiled my code with pyinstaller to make a .exe but when I launch it, it told me the module 'pydantic.deprecated.decorator' wasn't found. that seems logic because I have nothing with that name. So I don't know what to do to solve this issue
I already tried to reinstal pydantic
Traceback (most recent call last):
File "pydantic\_internal\_validators.py", line 99, in _import_string_logic
File "importlib\__init__.py", line 126, in import_module
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'pydantic.deprecated.decorator'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "pydantic\_internal\_validators.py", line 62, in import_string
File "pydantic\_internal\_validators.py", line 108, in _import_string_logic
ImportError: No module named 'pydantic.deprecated.decorator'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "UX.py", line 9, in <module>
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
File "RAG_modif_pour_UX.py", line 18, in <module>
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
File "langchain_ollama\__init__.py", line 3, in <module>
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
File "langchain_ollama\chat_models.py", line 39, in <module>
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
File "langchain_core\tools\__init__.py", line 22, in <module>
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "PyInstaller\loader\pyimod02_importers.py", line 384, in exec_module
File "langchain_core\tools\base.py", line 27, in <module>
File "<frozen importlib._bootstrap>", line 1229, in _handle_fromlist
File "pydantic\__init__.py", line 402, in __getattr__
File "pydantic\_migration.py", line 287, in wrapper
File "pydantic\_internal\_validators.py", line 64, in import_string
pydantic_core._pydantic_core.PydanticCustomError: Invalid python path: No module named 'pydantic.deprecated.decorator'
I have faced a similar error message. What has fixed it for me was to add hidden imports.
With the following hidden imports that problem went away:
pyinstaller --hidden-import=pydantic --hidden-import=pydantic-core --hidden-import=pydantic.deprecated.decorator app.py
The langchain modules use pydantic under the hood and without the hidden imports it will not be able to find the modules. At least that is my understanding at this point.