Description
Checked other resources
- I added a very descriptive title to this issue.
- I searched the LangChain documentation with the integrated search.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
This is a duplicate of langchain-ai/langchain#26294 because that issue is closed without any solution.
Basically, using UnstructuredLoader
from langchain_unstructured
inside a FastAPI app running with uvloop instead of asyncio loop results in Can't patch loop of type <class 'uvloop.Loop'>
error.
Error Message and Stack Trace (if applicable)
No response
Description
UnstructuredLoader should work inside FastAPI regardless of what mode is used in FastAPI.
System Info
aiocache==0.12.3
aiofiles==24.1.0
aiohttp==3.9.5
aiosignal==1.3.1
aiostream==0.6.2
alembic==1.13.3
amqp==5.2.0
annotated-types==0.7.0
antlr4-python3-runtime==4.9.3
anyio==4.4.0
async-timeout==4.0.3
attrs==23.2.0
backoff==2.2.1
beautifulsoup4==4.12.3
bidict==0.23.1
billiard==4.2.1
cachetools==5.5.0
celery==5.4.0
certifi==2024.7.4
cffi==1.16.0
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.7
click-didyoumean==0.3.1
click-plugins==1.1.1
click-repl==0.3.0
coloredlogs==15.0.1
contourpy==1.3.1
cryptography==43.0.0
cycler==0.12.1
dataclasses-json==0.6.7
debugpy==1.8.5
Deprecated==1.2.15
dill==0.3.9
distro==1.9.0
dnspython==2.6.1
ecdsa==0.19.0
effdet==0.4.1
email_validator==2.2.0
emoji==2.14.0
eval_type_backport==0.2.2
exceptiongroup==1.2.2
fastapi==0.111.1
fastapi-cli==0.0.4
filelock==3.16.1
filetype==1.2.0
flatbuffers==24.12.23
flower==2.0.1
fonttools==4.55.3
frozenlist==1.4.1
fsspec==2024.12.0
google-api-core==2.24.0
google-auth==2.37.0
google-cloud-vision==3.9.0
googleapis-common-protos==1.66.0
greenlet==3.0.3
grpcio==1.69.0
grpcio-status==1.69.0
grpcio-tools==1.66.1
gunicorn==23.0.0
h11==0.14.0
h2==4.1.0
hpack==4.0.0
html5lib==1.1
httpcore==1.0.5
httptools==0.6.1
httpx==0.27.0
httpx-sse==0.4.0
huggingface-hub==0.27.0
humanfriendly==10.0
humanize==4.11.0
hyperframe==6.0.1
idna==3.7
iniconfig==2.0.0
iopath==0.1.10
iso-639==0.4.5
Jinja2==3.1.4
jiter==0.8.2
joblib==1.4.2
jsonpatch==1.33
jsonpath-python==1.0.6
jsonpointer==3.0.0
kiwisolver==1.4.8
kombu==5.4.2
langchain==0.3.14
langchain-community==0.3.14
langchain-core==0.3.33
langchain-openai==0.3.3
langchain-text-splitters==0.3.4
langchain-unstructured==0.1.6
langdetect==1.0.9
langsmith==0.2.10
layoutparser==0.3.4
lxml==5.3.0
Mako==1.3.5
markdown-it-py==3.0.0
MarkupSafe==2.1.5
marshmallow==3.21.3
matplotlib==3.10.0
mdurl==0.1.2
mpire==2.10.2
mpmath==1.3.0
multidict==6.0.5
multiprocess==0.70.17
mypy-extensions==1.0.0
ndjson==0.3.1
nest-asyncio==1.6.0
networkx==3.4.2
nltk==3.9.1
numpy==1.26.4
olefile==0.47
omegaconf==2.3.0
onnx==1.17.0
onnxruntime==1.19.2
openai==1.59.3
opencv-python==4.10.0.84
orjson==3.10.6
packaging==24.1
pandas==2.2.3
pdf2image==1.17.0
pdfminer.six==20231228
pdfplumber==0.11.5
pi_heif==0.21.0
pikepdf==9.5.1
pillow==10.4.0
pip-autoremove==0.10.0
pipdeptree==2.24.0
pluggy==1.5.0
portalocker==2.10.1
prometheus_client==0.21.0
prompt_toolkit==3.0.48
proto-plus==1.25.0
protobuf==5.28.0
psutil==6.1.1
psycopg==3.2.4
psycopg-binary==3.2.4
psycopg-pool==3.2.4
pyalex==0.15
pyasn1==0.6.0
pyasn1_modules==0.4.1
pycocotools==2.0.8
pycountry==24.6.1
pycparser==2.22
pydantic==2.9.2
pydantic-settings==2.7.0
pydantic_core==2.23.4
Pygments==2.18.0
pyparsing==3.2.1
pypdf==4.3.1
pypdfium2==4.30.1
pytest==8.3.2
pytest-asyncio==0.23.8
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
python-engineio @ git+https://github.com/fatadel/python-engineio.git@b137e2c21deee534533b6ace82f758df8ccc6d3f
python-iso639==2024.10.22
python-jose==3.3.0
python-magic==0.4.27
python-multipart==0.0.9
python-oxmsg==0.0.1
python-socketio==5.11.4
pytz==2024.2
PyYAML==6.0.1
qdrant-client==1.11.1
RapidFuzz==3.11.0
regex==2024.7.24
requests==2.32.3
requests-toolbelt==1.0.0
rich==13.7.1
rsa==4.9
safetensors==0.4.5
scipy==1.14.1
semchunk==2.2.2
sentry-sdk==2.11.0
setuptools==75.6.0
shellingham==1.5.4
simple-websocket==1.0.0
six==1.16.0
sniffio==1.3.1
soupsieve==2.6
SQLAlchemy==2.0.31
sqlmodel==0.0.22
starlette==0.37.2
sympy==1.13.1
tenacity==8.5.0
tiktoken==0.7.0
timm==1.0.13
tokenizers==0.21.0
tomli==2.0.1
torch==2.5.1
torchvision==0.20.1
tornado==6.4.1
tqdm==4.66.4
transformers==4.47.1
typer==0.12.5
typing-inspect==0.9.0
typing_extensions==4.12.2
tzdata==2024.2
unstructured==0.16.12
unstructured-client==0.28.1
unstructured-inference==0.8.1
unstructured.pytesseract==0.3.13
urllib3==2.2.2
uvicorn==0.30.3
uvicorn-worker==0.2.0
uvloop==0.19.0
vine==5.1.0
watchfiles==0.22.0
wcwidth==0.2.13
webencodings==0.5.1
websockets==12.0
wrapt==1.17.1
wsproto==1.2.0
yarl==1.9.4