diff --git a/.github/workflows/CI_Windows.yml b/.github/workflows/CI_Windows.yml index b6751e51d..53dff82ec 100644 --- a/.github/workflows/CI_Windows.yml +++ b/.github/workflows/CI_Windows.yml @@ -57,9 +57,15 @@ jobs: python -c 'import pysr; pysr.install()' - name: "Run tests" run: python -m pysr.test main + env: + JULIA_CHECK_BOUNDS: yes - name: "Install Torch" run: pip install torch # (optional import) - name: "Run Torch tests" run: python -m pysr.test torch + env: + JULIA_CHECK_BOUNDS: yes - name: "Run custom env tests" run: python -m pysr.test env + env: + JULIA_CHECK_BOUNDS: yes diff --git a/pysr/julia_helpers.py b/pysr/julia_helpers.py index b0ec30d24..01d9c3c6a 100644 --- a/pysr/julia_helpers.py +++ b/pysr/julia_helpers.py @@ -169,6 +169,9 @@ def init_julia(julia_project=None, quiet=False, julia_kwargs=None, return_aux=Fa if julia_kwargs is None: julia_kwargs = {"optimize": 3} + if "check_bounds" not in julia_kwargs and "JULIA_CHECK_BOUNDS" in os.environ: + julia_kwargs["check_bounds"] = os.environ["JULIA_CHECK_BOUNDS"] + from julia.core import JuliaInfo, UnsupportedPythonError _julia_version_assertion() @@ -192,6 +195,11 @@ def init_julia(julia_project=None, quiet=False, julia_kwargs=None, return_aux=Fa Julia(**julia_kwargs) except UnsupportedPythonError: # Static python binary, so we turn off pre-compiled modules. + warnings.warn( + "You are using a statically-linked Python binary. " + "The first run of PySR will be slower, as all dependencies need to be compiled. " + "Switch to a dynamically-linked version of Python (like pyenv) to have a faster startup time." + ) julia_kwargs = {**julia_kwargs, "compiled_modules": False} Julia(**julia_kwargs)