Spaces:
Sleeping
Sleeping
Fix CAI installation - remove deprecated --no-use-pep517 flag
Browse files- Remove --no-use-pep517 flag that's not supported in newer pip versions
- Use clone-and-install approach instead
- Clone CAI repo to temp directory and install from local path
- This avoids both the deprecated flag issue and wheel naming problems
app.py
CHANGED
|
@@ -11,11 +11,32 @@ def setup_cai_if_needed():
|
|
| 11 |
print("CAI not found, attempting to install...")
|
| 12 |
try:
|
| 13 |
import subprocess
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
import CAI
|
| 20 |
print("✅ CAI installed successfully")
|
| 21 |
return True
|
|
|
|
| 11 |
print("CAI not found, attempting to install...")
|
| 12 |
try:
|
| 13 |
import subprocess
|
| 14 |
+
import tempfile
|
| 15 |
+
import shutil
|
| 16 |
+
|
| 17 |
+
# Clone the repository to a temporary directory
|
| 18 |
+
with tempfile.TemporaryDirectory() as temp_dir:
|
| 19 |
+
repo_dir = os.path.join(temp_dir, "cai")
|
| 20 |
+
|
| 21 |
+
print("Cloning CAI repository...")
|
| 22 |
+
subprocess.check_call([
|
| 23 |
+
"git", "clone",
|
| 24 |
+
"https://github.com/Benjamin-Lee/CodonAdaptationIndex.git",
|
| 25 |
+
repo_dir
|
| 26 |
+
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 27 |
+
|
| 28 |
+
# Checkout specific commit
|
| 29 |
+
subprocess.check_call([
|
| 30 |
+
"git", "checkout",
|
| 31 |
+
"b6e017a92c58829f6a5aec8c26a21262bc2a6610"
|
| 32 |
+
], cwd=repo_dir, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 33 |
+
|
| 34 |
+
print("Installing CAI from local directory...")
|
| 35 |
+
# Install from local directory - this avoids wheel naming issues
|
| 36 |
+
subprocess.check_call([
|
| 37 |
+
sys.executable, "-m", "pip", "install", "--no-cache-dir", "."
|
| 38 |
+
], cwd=repo_dir)
|
| 39 |
+
|
| 40 |
import CAI
|
| 41 |
print("✅ CAI installed successfully")
|
| 42 |
return True
|