Ich habe ein virtual environment mit conda erstellt. Ich wechsle mit
Code: Alles auswählen
conda activate test-env
Wenn ich mein Skript mit python testserver.py ausführe, dann funktioniert alles.
Wenn ich aber mein Skript mit fastapi ausführe (fastapi run testserver.py) dann bekomme ich folgende Fehlermeldung:
Code: Alles auswählen
INFO Importing module testserver
ERROR Import error: No module named 'langchain_chroma'
WARNING Ensure all the package directories have an __init__.py file ....
ModuleNotFoundError: No module named 'langchain_chroma'
Code: Alles auswählen
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from langchain_chroma import Chroma
import os
conda_env = os.getenv('CONDA_DEFAULT_ENV')
if conda_env:
print(f"Conda Environment: {conda_env}")
else:
print("Not using a Conda environment.")
app = FastAPI()
@app.get('/')
def get():
return HTMLResponse("", status_code=200)
Code: Alles auswählen
print(f"Conda Environment: {conda_env}")
Code: Alles auswählen
(test-env) C:\test>where fastapi
C:\Users\Michael\AppData\Local\anaconda3\Scripts\fastapi.exe
Code: Alles auswählen
(test-envl) C:\test>where python
C:\Users\Michael\AppData\Local\anaconda3\envs\test-env\python.exe
C:\Python311\python.exe
Code: Alles auswählen
(test-env) C:\test>pip list
Package Version
---------------------------------------- -----------
aiohttp 3.9.5
aiosignal 1.3.1
annotated-types 0.6.0
antlr4-python3-runtime 4.9.3
anyio 4.3.0
asgiref 3.8.1
asttokens 2.4.1
async-timeout 4.0.3
attrs 23.2.0
backoff 2.2.1
bcrypt 4.1.2
beautifulsoup4 4.12.3
build 1.2.1
cachetools 5.3.3
certifi 2024.2.2
cffi 1.16.0
chardet 5.2.0
charset-normalizer 3.3.2
chroma-hnswlib 0.7.3
chromadb 0.5.0
click 8.1.7
colorama 0.4.6
coloredlogs 15.0.1
comm 0.2.2
contourpy 1.2.1
cryptography 43.0.0
cycler 0.12.1
dataclasses-json 0.6.4
debugpy 1.8.1
decorator 5.1.1
deepdiff 7.0.1
Deprecated 1.2.14
distro 1.9.0
dnspython 2.6.1
effdet 0.4.1
email_validator 2.2.0
emoji 2.12.1
et-xmlfile 1.1.0
exceptiongroup 1.2.1
executing 2.0.1
fastapi 0.110.2
filelock 3.13.4
filetype 1.2.0
flatbuffers 24.3.25
fonttools 4.53.1
frozenlist 1.4.1
fsspec 2024.3.1
gitdb 4.0.11
GitPython 3.1.43
google-api-core 2.19.1
google-auth 2.29.0
google-cloud-vision 3.7.4
googleapis-common-protos 1.63.0
greenlet 3.0.3
grpcio 1.62.2
grpcio-status 1.62.2
h11 0.14.0
httpcore 1.0.5
httptools 0.6.1
httpx 0.27.0
huggingface-hub 0.24.5
humanfriendly 10.0
idna 3.7
importlib-metadata 7.0.0
importlib_resources 6.4.0
iopath 0.1.10
ipykernel 6.29.4
ipython 8.24.0
itsdangerous 2.2.0
jedi 0.19.1
Jinja2 3.1.4
joblib 1.4.2
jsonpatch 1.33
jsonpath-python 1.0.6
jsonpointer 2.4
jsonschema 4.23.0
jsonschema-specifications 2023.12.1
jupyter_client 8.6.1
jupyter_core 5.7.2
kiwisolver 1.4.5
kubernetes 29.0.0
langchain 0.2.11
langchain-chroma 0.1.2
langchain-cli 0.0.27
langchain-community 0.2.10
langchain-core 0.2.25
langchain-text-splitters 0.2.2
langchain-unstructured 0.1.1
langdetect 1.0.9
langserve 0.2.2
langsmith 0.1.94
layoutparser 0.3.4
libcst 1.4.0
lxml 5.2.2
Markdown 3.6
markdown-it-py 3.0.0
MarkupSafe 2.1.5
marshmallow 3.21.1
matplotlib 3.9.1
matplotlib-inline 0.1.7
mdurl 0.1.2
mmh3 4.1.0
monotonic 1.6
mpmath 1.3.0
multidict 6.0.5
mypy-extensions 1.0.0
nest-asyncio 1.6.0
networkx 3.3
nltk 3.8.1
numpy 1.26.4
oauthlib 3.2.2
olefile 0.47
omegaconf 2.3.0
onnx 1.16.1
onnxruntime 1.17.3
openai 1.23.6
opencv-python 4.10.0.84
openpyxl 3.1.5
opentelemetry-api 1.24.0
opentelemetry-exporter-otlp-proto-common 1.24.0
opentelemetry-exporter-otlp-proto-grpc 1.24.0
opentelemetry-instrumentation 0.45b0
opentelemetry-instrumentation-asgi 0.45b0
opentelemetry-instrumentation-fastapi 0.45b0
opentelemetry-proto 1.24.0
opentelemetry-sdk 1.24.0
opentelemetry-semantic-conventions 0.45b0
opentelemetry-util-http 0.45b0
ordered-set 4.1.0
orjson 3.10.1
overrides 7.7.0
packaging 23.2
pandas 2.2.2
parso 0.8.4
pdf2image 1.17.0
pdfminer.six 20231228
pdfplumber 0.11.2
pikepdf 9.1.0
pillow 10.4.0
pillow_heif 0.18.0
pip 24.2
platformdirs 4.2.1
portalocker 2.10.1
posthog 3.5.0
prompt-toolkit 3.0.43
proto-plus 1.24.0
protobuf 4.25.3
psutil 5.9.8
pure-eval 0.2.2
pyasn1 0.6.0
pyasn1_modules 0.4.0
pycocotools 2.0.8
pycparser 2.22
pydantic 2.7.1
pydantic_core 2.18.2
pydantic-extra-types 2.9.0
pydantic-settings 2.4.0
Pygments 2.17.2
PyMuPDF 1.24.9
PyMuPDFb 1.24.9
pypandoc 1.13
pyparsing 3.1.2
pypdf 4.2.0
pypdfium2 4.30.0
PyPika 0.48.9
pyproject_hooks 1.0.0
pyproject-toml 0.0.10
pyreadline3 3.4.1
pytesseract 0.3.10
python-dateutil 2.9.0.post0
python-docx 1.1.2
python-dotenv 1.0.1
python-iso639 2024.4.27
python-magic 0.4.27
python-multipart 0.0.9
python-oxmsg 0.0.1
python-pptx 0.6.23
pytz 2024.1
pywin32 306
PyYAML 6.0.1
pyzmq 26.0.2
rapidfuzz 3.9.5
referencing 0.35.1
regex 2024.4.16
requests 2.31.0
requests-oauthlib 2.0.0
requests-toolbelt 1.0.0
rich 13.7.1
rpds-py 0.19.1
rsa 4.9
safetensors 0.4.3
scipy 1.14.0
setuptools 72.1.0
shellingham 1.5.4
six 1.16.0
smmap 5.0.1
sniffio 1.3.1
soupsieve 2.5
SQLAlchemy 2.0.29
sse-starlette 1.8.2
stack-data 0.6.3
starlette 0.37.2
sympy 1.12
tabulate 0.9.0
tenacity 8.2.3
tiktoken 0.6.0
timm 1.0.8
tokenizers 0.19.1
toml 0.10.2
tomli 2.0.1
tomlkit 0.12.5
torch 2.4.0
torchvision 0.19.0
tornado 6.4
tqdm 4.66.2
traitlets 5.14.3
transformers 4.43.3
typer 0.9.4
typing_extensions 4.11.0
typing-inspect 0.9.0
tzdata 2024.1
ujson 5.10.0
unstructured 0.15.0
unstructured-client 0.24.1
unstructured-inference 0.7.36
unstructured.pytesseract 0.3.12
urllib3 2.2.1
uvicorn 0.23.2
watchfiles 0.21.0
wcwidth 0.2.13
websocket-client 1.8.0
websockets 12.0
wheel 0.43.0
wrapt 1.16.0
xlrd 2.0.1
XlsxWriter 3.2.0
yarl 1.9.4
zipp 3.18.1