Spaces:
Sleeping
Sleeping
MilesCranmer
commited on
Commit
•
5d9233a
1
Parent(s):
b1eaa8d
Better error handling for import error
Browse files- pysr/sr.py +2 -1
pysr/sr.py
CHANGED
@@ -1050,13 +1050,14 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
|
|
1050 |
Main.eval(
|
1051 |
f'Pkg.activate("{_escape_filename(self.julia_project)}", io={io})'
|
1052 |
)
|
|
|
1053 |
try:
|
1054 |
if update:
|
1055 |
Main.eval(f"Pkg.resolve(io={io})")
|
1056 |
Main.eval(f"Pkg.instantiate(io={io})")
|
1057 |
else:
|
1058 |
Main.eval(f"Pkg.instantiate(io={io})")
|
1059 |
-
except RuntimeError as e:
|
1060 |
raise ImportError(import_error_string(self.julia_project)) from e
|
1061 |
Main.eval("using SymbolicRegression")
|
1062 |
|
|
|
1050 |
Main.eval(
|
1051 |
f'Pkg.activate("{_escape_filename(self.julia_project)}", io={io})'
|
1052 |
)
|
1053 |
+
from julia.api import JuliaError
|
1054 |
try:
|
1055 |
if update:
|
1056 |
Main.eval(f"Pkg.resolve(io={io})")
|
1057 |
Main.eval(f"Pkg.instantiate(io={io})")
|
1058 |
else:
|
1059 |
Main.eval(f"Pkg.instantiate(io={io})")
|
1060 |
+
except (JuliaError, RuntimeError) as e:
|
1061 |
raise ImportError(import_error_string(self.julia_project)) from e
|
1062 |
Main.eval("using SymbolicRegression")
|
1063 |
|