MilesCranmer commited on
Commit
d09ade8
1 Parent(s): 2f64833

Only create new env if update=True

Browse files
Files changed (1) hide show
  1. pysr/sr.py +6 -8
pysr/sr.py CHANGED
@@ -1447,15 +1447,13 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
1447
  )
1448
  from julia.api import JuliaError
1449
 
1450
- if is_shared:
1451
- # Install SymbolicRegression.jl:
1452
- _add_sr_to_julia_project(Main, io_arg)
1453
-
1454
- try:
1455
- if self.update:
1456
  Main.eval(f"Pkg.resolve({io_arg})")
1457
- except (JuliaError, RuntimeError) as e:
1458
- raise ImportError(import_error_string(julia_project)) from e
1459
  Main.eval("using SymbolicRegression")
1460
 
1461
  Main.plus = Main.eval("(+)")
 
1447
  )
1448
  from julia.api import JuliaError
1449
 
1450
+ if self.update:
1451
+ try:
1452
+ if is_shared:
1453
+ _add_sr_to_julia_project(Main, io_arg)
 
 
1454
  Main.eval(f"Pkg.resolve({io_arg})")
1455
+ except (JuliaError, RuntimeError) as e:
1456
+ raise ImportError(import_error_string(julia_project)) from e
1457
  Main.eval("using SymbolicRegression")
1458
 
1459
  Main.plus = Main.eval("(+)")