Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
fc68797
1
Parent(s):
49212e1
Fix version checking function
Browse files- pysr/sr.py +3 -3
pysr/sr.py
CHANGED
@@ -32,7 +32,7 @@ def install(julia_project=None, quiet=False): # pragma: no cover
|
|
32 |
Main.eval("using Pkg")
|
33 |
|
34 |
io = "devnull" if quiet else "stderr"
|
35 |
-
io_arg = f"io={io}" if
|
36 |
|
37 |
# Can't pass IO to Julia call as it evaluates to PyObject, so just directly
|
38 |
# use Main.eval:
|
@@ -297,7 +297,7 @@ def silence_julia_warning():
|
|
297 |
is_julia_warning_silenced = True
|
298 |
|
299 |
|
300 |
-
def
|
301 |
"""Check if Julia version is greater than specified version."""
|
302 |
return Main.eval(f'VERSION >= v"{version}"')
|
303 |
|
@@ -1048,7 +1048,7 @@ class PySRRegressor(BaseEstimator, RegressorMixin):
|
|
1048 |
if not already_ran:
|
1049 |
Main.eval("using Pkg")
|
1050 |
io = "devnull" if self.params["verbosity"] == 0 else "stderr"
|
1051 |
-
io_arg = f"io={io}" if
|
1052 |
|
1053 |
Main.eval(
|
1054 |
f'Pkg.activate("{_escape_filename(self.julia_project)}", {io_arg})'
|
|
|
32 |
Main.eval("using Pkg")
|
33 |
|
34 |
io = "devnull" if quiet else "stderr"
|
35 |
+
io_arg = f"io={io}" if is_julia_version_greater_eq(Main, "1.6") else ""
|
36 |
|
37 |
# Can't pass IO to Julia call as it evaluates to PyObject, so just directly
|
38 |
# use Main.eval:
|
|
|
297 |
is_julia_warning_silenced = True
|
298 |
|
299 |
|
300 |
+
def is_julia_version_greater_eq(Main, version="1.6"):
|
301 |
"""Check if Julia version is greater than specified version."""
|
302 |
return Main.eval(f'VERSION >= v"{version}"')
|
303 |
|
|
|
1048 |
if not already_ran:
|
1049 |
Main.eval("using Pkg")
|
1050 |
io = "devnull" if self.params["verbosity"] == 0 else "stderr"
|
1051 |
+
io_arg = f"io={io}" if is_julia_version_greater_eq(Main, "1.6") else ""
|
1052 |
|
1053 |
Main.eval(
|
1054 |
f'Pkg.activate("{_escape_filename(self.julia_project)}", {io_arg})'
|