Skip to content

Commit

Permalink
Only create new env if update=True
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Sep 5, 2022
1 parent 2f64833 commit d09ade8
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pysr/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1447,15 +1447,13 @@ def _run(self, X, y, mutated_params, weights, seed):
)
from julia.api import JuliaError

if is_shared:
# Install SymbolicRegression.jl:
_add_sr_to_julia_project(Main, io_arg)

try:
if self.update:
if self.update:
try:
if is_shared:
_add_sr_to_julia_project(Main, io_arg)
Main.eval(f"Pkg.resolve({io_arg})")
except (JuliaError, RuntimeError) as e:
raise ImportError(import_error_string(julia_project)) from e
except (JuliaError, RuntimeError) as e:
raise ImportError(import_error_string(julia_project)) from e
Main.eval("using SymbolicRegression")

Main.plus = Main.eval("(+)")
Expand Down

0 comments on commit d09ade8

Please sign in to comment.