-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathtest_course_environment.py
68 lines (59 loc) · 1.91 KB
/
test_course_environment.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
56
57
58
59
60
61
62
63
64
65
66
67
68
""" This script tests whether you're ready to start with the course! """
import os
import sys
import os.path as op
here = op.dirname(__file__)
print("Checking Python version ... \t\t\t", end='')
py_version = sys.version.split(' ')[0]
if py_version == '3.9.16':
has_py3916 = True
print("OK!")
else:
has_py3916 = False
print("NOT OK!")
# Check anaconda
print("Checking anaconda installation ... \t\t", end='')
if 'conda' not in sys.executable:
has_anaconda = False
for p in sys.path:
if '/tljh/' in p:
# TLJH actually uses miniconda!
has_anaconda = True
if not has_anaconda:
print("WARNING!")
else:
print("OK!")
else:
has_anaconda = True
print("OK!")
try:
print("Checking niedu installation ... \t\t", end='')
import niedu
except ImportError:
has_niedu = False
print("NOT OK!")
else:
has_niedu = True
print("OK!")
print('Checking FSL installation ... \t\t\t', end='')
if not 'FSLDIR' in os.environ:
has_fsl = False
print("NOT OK!")
else:
has_fsl = True
print("OK!")
if not has_anaconda:
print("\nWhile it's not strictly necessary, we highly recommend\n"
"using the Anaconda distrution for Python! See course website\n"
"for more information: https://lukas-snoek.com/NI-edu/getting_started/installation.html")
else:
if not has_py3916:
print(f"\nYou seem to have the 'wrong' Python version (has {py_version}, need 3.9.16).\n"
"Please see the installation instructions here:\n"
"https://lukas-snoek.com/NI-edu/getting_started/installation.html")
if not has_niedu:
print("\nYou MUST install the 'niedu' package to follow this course.\n"
"Please run the following in the root directory:\n"
"'pip install .'\n\n"
"Note that you need to install this as root when working from\n"
"a TLJH-based Jupyterhub setup!")