Spaces:
Sleeping
Sleeping
File size: 2,430 Bytes
500cf95 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
"""
Verify all dependencies are installed correctly
Run: python verify_dependencies.py
"""
import sys
def check_dependency(module_name, package_name=None):
"""Check if a dependency is installed"""
if package_name is None:
package_name = module_name
try:
__import__(module_name)
print(f"β {package_name}")
return True
except ImportError as e:
print(f"β {package_name} - NOT INSTALLED")
print(f" Error: {e}")
return False
def main():
print("="*60)
print("Dependency Verification")
print("="*60)
dependencies = [
# Web framework
("fastapi", "fastapi"),
("uvicorn", "uvicorn"),
("multipart", "python-multipart"),
# ML & Embeddings
("torch", "torch"),
("transformers", "transformers"),
("PIL", "pillow"),
("numpy", "numpy"),
# Vector DB
("qdrant_client", "qdrant-client"),
# Utilities
("pydantic", "pydantic"),
("dotenv", "python-dotenv"),
# MongoDB
("pymongo", "pymongo"),
("huggingface_hub", "huggingface-hub"),
("timm", "timm"),
("einops", "einops"),
# PDF Processing (NEW)
("pypdfium2", "pypdfium2"),
]
print("\nChecking dependencies...\n")
all_ok = True
for module, package in dependencies:
if not check_dependency(module, package):
all_ok = False
print("\n" + "="*60)
if all_ok:
print("β All dependencies installed successfully!")
print("\nYou can now run:")
print(" python main.py")
else:
print("β Some dependencies are missing!")
print("\nPlease install missing dependencies:")
print(" pip install -r requirements.txt")
sys.exit(1)
print("="*60)
# Check optional features
print("\nChecking system modules...\n")
# Check our custom modules
custom_modules = [
"embedding_service",
"qdrant_service",
"advanced_rag",
"pdf_parser",
"multimodal_pdf_parser",
]
for module in custom_modules:
try:
__import__(module)
print(f"β {module}.py")
except ImportError as e:
print(f"β {module}.py - ERROR: {e}")
print("\n" + "="*60)
print("Verification complete!")
print("="*60)
if __name__ == "__main__":
main()
|