|
|
""" |
|
|
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 = [ |
|
|
|
|
|
("fastapi", "fastapi"), |
|
|
("uvicorn", "uvicorn"), |
|
|
("multipart", "python-multipart"), |
|
|
|
|
|
|
|
|
("torch", "torch"), |
|
|
("transformers", "transformers"), |
|
|
("PIL", "pillow"), |
|
|
("numpy", "numpy"), |
|
|
|
|
|
|
|
|
("qdrant_client", "qdrant-client"), |
|
|
|
|
|
|
|
|
("pydantic", "pydantic"), |
|
|
("dotenv", "python-dotenv"), |
|
|
|
|
|
|
|
|
("pymongo", "pymongo"), |
|
|
("huggingface_hub", "huggingface-hub"), |
|
|
("timm", "timm"), |
|
|
("einops", "einops"), |
|
|
|
|
|
|
|
|
("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) |
|
|
|
|
|
|
|
|
print("\nChecking system modules...\n") |
|
|
|
|
|
|
|
|
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() |
|
|
|