Repository navigation
Expand file tree
/
Copy pathinstallcheck.py
More file actions
62 lines (53 loc) · 1.84 KB
/
Copy pathinstallcheck.py
File metadata and controls
62 lines (53 loc) · 1.84 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
#!/usr/bin/env python3
"""
Installation verification script for Machine Learning course environment.
Run this script to verify that all required packages are properly installed.
"""
import sys
def check_package(package_name, import_name=None):
"""Check if a package is installed and print its version."""
if import_name is None:
import_name = package_name
try:
module = __import__(import_name)
version = getattr(module, '__version__', 'Unknown version')
print(f'{package_name}: {version}')
return True
except ImportError:
print(f'{package_name}: NOT INSTALLED')
return False
def main():
"""Main function to check all required packages."""
print("Machine Learning Course - Package Installation Check")
print("=" * 50)
print(f"Python version: {sys.version}")
print("-" * 50)
packages = [
('numpy', 'numpy'),
('pandas', 'pandas'),
('matplotlib', 'matplotlib'),
('seaborn', 'seaborn'),
('scikit-learn', 'sklearn'),
('jupyter', 'jupyter'),
('ipykernel', 'ipykernel'),
('nbformat', 'nbformat'),
('nbclient', 'nbclient'),
('joblib', 'joblib'),
('xgboost', 'xgboost'),
('psutil', 'psutil'),
('GPUtil', 'GPUtil'),
]
all_installed = True
for package_name, import_name in packages:
if not check_package(package_name, import_name):
all_installed = False
print("-" * 50)
if all_installed:
print("All packages are installed successfully!")
else:
print("Some packages are missing. Install them with either pip or conda, e.g.:")
print(" pip install -r requirements.txt")
print("or install individually, e.g.:")
print(" pip install xgboost psutil GPUtil")
if __name__ == "__main__":
main()