MilesCranmer commited on
Commit
c3134ec
1 Parent(s): ae34ce8

Better error message for missing Julia

Browse files
Files changed (1) hide show
  1. pysr/sr.py +8 -1
pysr/sr.py CHANGED
@@ -304,7 +304,14 @@ def init_julia():
304
  global is_julia_warning_silenced
305
  from julia.core import JuliaInfo, UnsupportedPythonError
306
 
307
- info = JuliaInfo.load(julia="julia")
 
 
 
 
 
 
 
308
  if not info.is_pycall_built():
309
  raise ImportError(import_error_string())
310
 
 
304
  global is_julia_warning_silenced
305
  from julia.core import JuliaInfo, UnsupportedPythonError
306
 
307
+ try:
308
+ info = JuliaInfo.load(julia="julia")
309
+ except FileNotFoundError:
310
+ env_path = os.environ["PATH"]
311
+ raise FileNotFoundError(
312
+ f"Julia is not installed in your PATH. Please install Julia and add it to your PATH.\n\nCurrent PATH: {env_path}",
313
+ )
314
+
315
  if not info.is_pycall_built():
316
  raise ImportError(import_error_string())
317