forked from OceanCruises/SPASSO
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_modules.py
More file actions
39 lines (31 loc) · 1.05 KB
/
Copy pathcheck_modules.py
File metadata and controls
39 lines (31 loc) · 1.05 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Check Python modules for SPASSO run
Created on Thu Jan 16 10:06:06 2025
@author: lrousselet
"""
import importlib
#module name from pyproject.toml file
module_name = ['termcolor','pandas','netCDF4', 'motuclient', 'matplotlib',
'cmocean','scipy','xarray','basemap','basemap-data-hires',
'tabulate','simplekml','requests','importlib-metadate',
'pylatex','copernicusmarine','cblind']
list_installed = []
list_notinstalled = []
for mod in module_name:
spec = importlib.util.find_spec(mod)
if spec is not None:
version = importlib.metadata.version(mod)
list_installed.append(mod+' '+version)
else:
list_notinstalled.append(mod)
print('List of installed packages:')
print("\n".join(map(str,list_installed)))
print('\nList of missing packages:')
print("\n".join(map(str,list_notinstalled)))
# try:
# map(__import__,mod)
# print(mod+" is installed.")
# except ImportError:
# print(mod+" is not installed")