File size: 2,009 Bytes
2592750
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Install CAI package with workaround for wheel naming issues.
This script installs the CAI package using --no-use-pep517 to avoid
the dynamic wheel naming problem that occurs with pyproject.toml builds.
"""

import subprocess
import sys
import os

def install_cai():
    """Install CAI package with legacy setup.py build system."""
    print("Installing CAI package...")

    # CAI repository URL and commit
    cai_url = "git+https://github.com/Benjamin-Lee/CodonAdaptationIndex.git@b6e017a92c58829f6a5aec8c26a21262bc2a6610"

    try:
        # Install with --no-use-pep517 to force legacy setup.py build
        cmd = [
            sys.executable, "-m", "pip", "install",
            "--no-use-pep517",
            "--no-cache-dir",
            cai_url
        ]

        print(f"Running: {' '.join(cmd)}")
        result = subprocess.run(cmd, check=True, capture_output=True, text=True)

        print("CAI installation successful!")
        print(result.stdout)
        return True

    except subprocess.CalledProcessError as e:
        print(f"CAI installation failed: {e}")
        print(f"STDOUT: {e.stdout}")
        print(f"STDERR: {e.stderr}")
        return False

def verify_installation():
    """Verify CAI package can be imported."""
    try:
        import CAI
        from CAI import CAI as cai_func, relative_adaptiveness
        print("✅ CAI package imported successfully")
        return True
    except ImportError as e:
        print(f"❌ Failed to import CAI: {e}")
        return False

if __name__ == "__main__":
    print("ColiFormer CAI Package Installer")
    print("=" * 40)

    # Install CAI
    if install_cai():
        # Verify installation
        if verify_installation():
            print("🎉 CAI installation completed successfully!")
            sys.exit(0)
        else:
            print("💥 CAI installation verification failed!")
            sys.exit(1)
    else:
        print("💥 CAI installation failed!")
        sys.exit(1)