File size: 1,457 Bytes
d670799
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""

Script to fix dependency version conflicts

"""

import subprocess
import sys

def run_command(cmd):
    """Run a command and return success status"""
    try:
        print(f"Running: {cmd}")
        result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True)
        print(f"✅ Success: {cmd}")
        return True
    except subprocess.CalledProcessError as e:
        print(f"❌ Error: {cmd}")
        print(f"Error output: {e.stderr}")
        return False

def main():
    """Fix dependency issues"""
    print("🔧 Fixing dependency version conflicts...")
    
    # Uninstall problematic packages
    print("\n📦 Uninstalling conflicting packages...")
    packages_to_remove = [
        "mmcv",
        "mmdet", 
        "mmengine"
    ]
    
    for package in packages_to_remove:
        run_command(f"pip uninstall {package} -y")
    
    # Install compatible versions
    print("\n📦 Installing compatible versions...")
    compatible_packages = [
        "mmcv>=2.0.0,<2.2.0",
        "mmengine>=0.7.1,<1.0.0",
        "mmdet>=3.0.0,<4.0.0"
    ]
    
    for package in compatible_packages:
        if not run_command(f"pip install {package}"):
            print(f"⚠️  Failed to install {package}")
    
    print("\n✅ Dependency fix completed!")
    print("Now run: python test_app.py")

if __name__ == "__main__":
    main()