-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.py
More file actions
131 lines (96 loc) · 3.42 KB
/
install.py
File metadata and controls
131 lines (96 loc) · 3.42 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env python3
"""Installation script for the pose extraction system."""
import subprocess
import sys
from pathlib import Path
def run_command(command: str, check: bool = True) -> subprocess.CompletedProcess:
"""Run a shell command."""
print(f"Running: {command}")
result = subprocess.run(command, shell=True, capture_output=True, text=True)
if result.stdout:
print(result.stdout)
if result.stderr:
print(result.stderr, file=sys.stderr)
if check and result.returncode != 0:
raise subprocess.CalledProcessError(result.returncode, command)
return result
def check_uv_installed() -> bool:
"""Check if uv is installed."""
try:
run_command("uv --version", check=False)
return True
except (subprocess.CalledProcessError, FileNotFoundError):
return False
def install_uv():
"""Install uv if not already installed."""
if check_uv_installed():
print("uv is already installed")
return
print("Installing uv...")
if sys.platform == "win32":
run_command("powershell -c \"irm https://astral.sh/uv/install.ps1 | iex\"")
else:
run_command("curl -LsSf https://astral.sh/uv/install.sh | sh")
print("Please restart your terminal or run 'source ~/.bashrc' to use uv")
def setup_environment():
"""Set up the Python environment."""
print("Setting up Python environment...")
# Create virtual environment
run_command("uv venv")
# Install dependencies
run_command("uv pip install -e .")
# Install development dependencies
run_command("uv pip install -e '.[dev]'")
def create_directories():
"""Create necessary directories."""
print("Creating directories...")
directories = [
"data/video",
"data/poses",
"data/embeddings",
"data/analysis",
"models",
"logs"
]
for directory in directories:
Path(directory).mkdir(parents=True, exist_ok=True)
print(f"Created: {directory}")
def run_tests():
"""Run basic tests to verify installation."""
print("Running tests...")
try:
run_command("python tests/test_imports.py")
print("✓ All tests passed!")
except subprocess.CalledProcessError:
print("✗ Some tests failed. Please check the error messages above.")
return False
return True
def main():
"""Main installation function."""
print("Pose Extraction System - Installation")
print("=" * 50)
# Check Python version
if sys.version_info < (3, 8):
print("Error: Python 3.8 or higher is required")
sys.exit(1)
print(f"Python version: {sys.version}")
# Install uv if needed
install_uv()
# Set up environment
setup_environment()
# Create directories
create_directories()
# Run tests
if run_tests():
print("\n" + "=" * 50)
print("Installation completed successfully!")
print("\nNext steps:")
print("1. Place your dance videos in data/video/")
print("2. Run: python -m pose_extraction.main --input-dir data/video")
print("3. Check the examples/ directory for usage examples")
print("4. Read the documentation in documents/")
else:
print("\nInstallation completed with warnings.")
print("Please check the error messages above.")
if __name__ == "__main__":
main()