Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +17 -0
src/streamlit_app.py
CHANGED
@@ -17,6 +17,23 @@ from orb_models.forcefield.calculator import ORBCalculator
|
|
17 |
#from mattersim.forcefield import MatterSimCalculator
|
18 |
import pandas as pd
|
19 |
import yaml # Added for FairChem reference energies
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
from huggingface_hub import login
|
22 |
|
|
|
17 |
#from mattersim.forcefield import MatterSimCalculator
|
18 |
import pandas as pd
|
19 |
import yaml # Added for FairChem reference energies
|
20 |
+
import subprocess
|
21 |
+
import sys
|
22 |
+
import pkg_resources
|
23 |
+
|
24 |
+
# Define version threshold
|
25 |
+
required_version = "2.0.0"
|
26 |
+
|
27 |
+
try:
|
28 |
+
installed_version = pkg_resources.get_distribution("numpy").version
|
29 |
+
if pkg_resources.parse_version(installed_version) >= pkg_resources.parse_version(required_version):
|
30 |
+
print(f"numpy version {installed_version} >= {required_version}. Installing numpy<2.0.0...")
|
31 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy<2.0.0"])
|
32 |
+
else:
|
33 |
+
print(f"numpy version {installed_version} is already < {required_version}. No action needed.")
|
34 |
+
except pkg_resources.DistributionNotFound:
|
35 |
+
print("numpy is not installed. Installing numpy<2.0.0...")
|
36 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "numpy<2.0.0"])
|
37 |
|
38 |
from huggingface_hub import login
|
39 |
|