Skip to content

Instantly share code, notes, and snippets.

@tebeka
Created March 16, 2020 16:58
Show Gist options
  • Select an option

  • Save tebeka/9c36d673e71201cd545e3477230d525f to your computer and use it in GitHub Desktop.

Select an option

Save tebeka/9c36d673e71201cd545e3477230d525f to your computer and use it in GitHub Desktop.
Check install
import importlib
from sys import version_info
if version_info[:2] < (3, 6):
raise SystemExit('error: Python 3.6+ required')
missing = []
pkgs = (
('jupyterlab', 'jupyterlab'),
('matplotlib', 'matplotlib'),
('pandas', 'pandas'),
('sklearn', 'scikit-learn'),
)
for mod, pkg in pkgs:
try:
importlib.import_module(mod)
except ImportError:
missing.append(pkg)
if not missing:
print('You have all the requirement')
raise SystemExit()
missing = ', '.join(sorted(missing))
print('error: you are missing the following modules - {}'.format(missing))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment