-
Notifications
You must be signed in to change notification settings - Fork 73
/
check_installation.py
55 lines (44 loc) · 1.7 KB
/
check_installation.py
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
import warnings
import sys
import os
from distutils.version import StrictVersion
def warn(msg):
print msg
warnings.warn(msg)
warn.count += 1
warn.count = 0
def check_import(package_name, version=None):
try:
pkg = __import__(package_name)
except ImportError:
warn("Package {0} is not available".format(package_name))
return
if version:
pkg_version = pkg.__version__.rstrip('git').rstrip('-')
if StrictVersion(str(pkg_version)) < str(version):
warn("Package {0} is version {1}; "
"{2} or greater is recommended".format(pkg, pkg.__version__,
version))
# check Python version
if not (2, 6) <= sys.version_info[:2] <= (2, 7):
warn("Python 2.6 - 2.7 recommended")
# check package versions
check_import('numpy', '1.5')
check_import('scipy', '0.11')
check_import('IPython', '0.13')
check_import('matplotlib', '1.0')
check_import('sklearn', '0.12')
check_import('nose')
if warn.count > 0:
print(" - warning count: {0}.".format(warn_count))
print(" Consider upgrading your Python install:")
print(" Anaconda is a good all-in-one option: ")
print(" https://store.continuum.io/".format(warn.count))
else:
print(" - no warnings: Congratulations! ")
print(" Your Python installation appears up-to-date!")
print(" - please confirm that typing ``ipython notebook`` at your terminal")
print(" launches a browser window to the IPython dashboard. If not,")
print(" then there are other packages which must be installed. For")
print(" an easy all-in-one installation, try Anaconda:")
print(" https://store.continuum.io/")