Spaces:
Running
Running
MilesCranmer
commited on
Commit
•
1c3eec5
1
Parent(s):
67c22c7
Make precompilation optional
Browse files- pysr/julia_helpers.py +14 -2
- pysr/version.py +1 -1
pysr/julia_helpers.py
CHANGED
@@ -65,7 +65,7 @@ def _get_io_arg(quiet):
|
|
65 |
return io_arg
|
66 |
|
67 |
|
68 |
-
def install(julia_project=None, quiet=False): # pragma: no cover
|
69 |
"""
|
70 |
Install PyCall.jl and all required dependencies for SymbolicRegression.jl.
|
71 |
|
@@ -78,17 +78,29 @@ def install(julia_project=None, quiet=False): # pragma: no cover
|
|
78 |
processed_julia_project, is_shared = _process_julia_project(julia_project)
|
79 |
_set_julia_project_env(processed_julia_project, is_shared)
|
80 |
|
|
|
|
|
|
|
81 |
julia.install(quiet=quiet)
|
82 |
Main = init_julia(julia_project, quiet=quiet)
|
83 |
io_arg = _get_io_arg(quiet)
|
84 |
|
|
|
|
|
|
|
85 |
if is_shared:
|
86 |
# Install SymbolicRegression.jl:
|
87 |
_add_sr_to_julia_project(Main, io_arg)
|
88 |
|
89 |
Main.eval("using Pkg")
|
90 |
Main.eval(f"Pkg.instantiate({io_arg})")
|
91 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
if not quiet:
|
93 |
warnings.warn(
|
94 |
"It is recommended to restart Python after installing PySR's dependencies,"
|
|
|
65 |
return io_arg
|
66 |
|
67 |
|
68 |
+
def install(julia_project=None, quiet=False, precompile=True): # pragma: no cover
|
69 |
"""
|
70 |
Install PyCall.jl and all required dependencies for SymbolicRegression.jl.
|
71 |
|
|
|
78 |
processed_julia_project, is_shared = _process_julia_project(julia_project)
|
79 |
_set_julia_project_env(processed_julia_project, is_shared)
|
80 |
|
81 |
+
if not precompile:
|
82 |
+
os.environ["JULIA_PKG_PRECOMPILE_AUTO"] = "0"
|
83 |
+
|
84 |
julia.install(quiet=quiet)
|
85 |
Main = init_julia(julia_project, quiet=quiet)
|
86 |
io_arg = _get_io_arg(quiet)
|
87 |
|
88 |
+
if not precompile:
|
89 |
+
Main.eval('ENV["JULIA_PKG_PRECOMPILE_AUTO"] = 0')
|
90 |
+
|
91 |
if is_shared:
|
92 |
# Install SymbolicRegression.jl:
|
93 |
_add_sr_to_julia_project(Main, io_arg)
|
94 |
|
95 |
Main.eval("using Pkg")
|
96 |
Main.eval(f"Pkg.instantiate({io_arg})")
|
97 |
+
|
98 |
+
if precompile and (
|
99 |
+
"JULIA_PKG_PRECOMPILE_AUTO" not in os.environ
|
100 |
+
or str(os.environ["JULIA_PKG_PRECOMPILE_AUTO"]) != "0"
|
101 |
+
):
|
102 |
+
Main.eval(f"Pkg.precompile({io_arg})")
|
103 |
+
|
104 |
if not quiet:
|
105 |
warnings.warn(
|
106 |
"It is recommended to restart Python after installing PySR's dependencies,"
|
pysr/version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
__version__ = "0.11.
|
2 |
__symbolic_regression_jl_version__ = "0.15.0"
|
|
|
1 |
+
__version__ = "0.11.13"
|
2 |
__symbolic_regression_jl_version__ = "0.15.0"
|