Install_all_required_modules



In [1]:
#Install all required modules for alefuncs
import sys
from collections import Counter
from IPython.display import clear_output

missing_modules = Counter()
while True:
    try:
        from alefuncs import *
        break
    except ImportError as e:
        clear_output()
        missing_module = str(e).split()[-1].strip("'").lower()
        print(f'missing: {missing_module}')
        #Check aliases
        if missing_module == 'bio':
            missing_module = 'biopython'
        if missing_module == 'pil':
            missing_module = 'pillow'
        #Avoid looping over the same module
        missing_modules.update({missing_module})
        if missing_modules[missing_module] > 1:
            print(f"can't install {missing_module}, please try manually.")
            break
        #Install missing module
        !$sys.executable -m pip install $missing_module
        
print('All modules ready, you are good to go!')


All modules ready, you are good to go!

In [ ]: