Loading UnstructeredPDF fails after build with PyInstaller
Labels: name: area: doc loader, name: auto:bug

### System Info

Windows 11
Python 3.10
Langchain 0.0.286
Pyinstaller 5.7.0


  File "test1.py", line 5, in <module>
  File "langchain\document_loaders\unstructured.py", line 86, in load
  File "langchain\document_loaders\pdf.py", line 57, in _get_elements
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "unstructured\partition\pdf.py", line 40, in <module>
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "unstructured\partition\lang.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "iso639\__init__.py", line 4, in <module>
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "PyInstaller\loader\pyimod02_importers.py", line 499, in exec_module
  File "iso639\language.py", line 12, in <module>
sqlite3.OperationalError: unable to open database file
[19716] Failed to execute script 'test1' due to unhandled exception!


### Who can help?

@agola11 
@eyurtsev 

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [X] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

```
from langchain.document_loaders import UnstructuredPDFLoader
from langchain.text_splitter import RecursiveCharacterTextSplitter

loader = UnstructuredPDFLoader("C:\\Temp\\AI_experimenting\\indexer_test1\\test_docs\\testdoc1.pdf")
data = loader.load()
text_splitter = RecursiveCharacterTextSplitter(chunk_size=512, chunk_overlap=20)
docs_transformed = text_splitter.split_documents(data)
print (f'Number of chunks of data: {len(docs_transformed )}')
```

Compile the code above using the following Pyinstaller spec file:

```
# -*- mode: python -*-

import os
from os.path import join, dirname, basename

datas = [
("C:/Temp/AI_experimenting/venv/Lib/site-packages/langchain/chains/llm_summarization_checker/prompts/*.txt", "langchain/chains/llm_summarization_checker/prompts"),
]

googleapihidden = ["pkg_resources.py2_warn",
					"googleapiclient",
					"apiclient",
					"google-api-core"]

# list of modules to exclude from analysis
excludes = []

# list of hiddenimports
hiddenimports = googleapihidden

# binary data

# assets
tocs = []

a = Analysis(['test1.py'],
             pathex=[os.getcwd()],
             binaries=None,
             datas=datas,
             hiddenimports=hiddenimports,
             hookspath=[],
             runtime_hooks=[],
             excludes=excludes,
             win_no_prefer_redirects=False,
             win_private_assemblies=False)

pyz = PYZ(a.pure, a.zipped_data)

exe1 = EXE(pyz,
          a.scripts,
          name='mytest',
          exclude_binaries=True,
          icon='',
          debug=False,
		  bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True)

coll = COLLECT(exe1,
               a.binaries,
               a.zipfiles,
               a.datas,
               *tocs,
               strip=False,
               upx=True,
               name='mytest_V1')
``` 

Compile with: pyinstaller --log-level DEBUG test1.spec

Then in cmd terminal change working directory to ....dist\mytest_V1 and run mytest.exe


### Expected behavior

The expected behavior would be an output like:

Number of chunks of data: 18