Skip to content

Commit 48f8308

Browse files
authored
Merge pull request #4 from ericmjl/checkenv
Create checkenv.py
2 parents d83a358 + 6a5d93c commit 48f8308

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

checkenv.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Check that the packages are installed.
2+
from pkgutil import iter_modules
3+
import sys
4+
5+
6+
def check_import(packagename):
7+
if packagename in (name for _, name, _ in iter_modules()):
8+
return True
9+
else:
10+
return False
11+
12+
assert sys.version_info.major >= 3 and sys.version_info.minor >= 6, 'Please install Python 3.6!'
13+
14+
packages = ['jupyter', 'pymc3', 'seaborn', 'matplotlib', 'numpy', 'scipy',
15+
'pandas', 'tqdm', 'jupyterlab']
16+
17+
all_passed = True
18+
19+
for p in packages:
20+
assert check_import(p),\
21+
'{0} not present. Please install via pip or conda.'.format(p)
22+
23+
if all_passed:
24+
print('All checks passed. Your environment is good to go!')

0 commit comments

Comments
 (0)