MilesCranmer / PySR

High-Performance Symbolic Regression in Python and Julia
https://astroautomata.com/PySR
Apache License 2.0
2.09k stars 197 forks source link

[BUG]: PySR currently incompatible with Python 3.12 #451

Closed MilesCranmer closed 6 months ago

MilesCranmer commented 8 months ago

Until the PR at https://github.com/JuliaPy/pyjulia/pull/538 is merged, PySR is currently incompatible with Python 3.12. This is due to a breaking change in the way Python allowed PyJulia to overload the import function (like from julia import SymbolicRegression). It seems to be an easy patch though, luckily.

PaulGersberg commented 8 months ago

Also incompatible with 3.11.6 python -m pysr install Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\pysr\__main__.py", line 4, in <module> _cli(prog_name="pysr") File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\click\core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\pysr\julia_helpers.py", line 283, in _julia_version_assertion if not is_julia_version_greater_eq(version=(1, 6, 0)): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\pysr\julia_helpers.py", line 147, in is_julia_version_greater_eq juliainfo = _load_juliainfo() ^^^^^^^^^^^^^^^^^ File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\pysr\julia_helpers.py", line 25, in _load_juliainfo juliainfo = JuliaInfo.load(julia="julia") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pgersber\AppData\Local\miniconda3\Lib\site-packages\julia\juliainfo.py", line 87, in load raise subprocess.CalledProcessError( subprocess.CalledProcessError: Command '['julia', '-e', '...']' returned non-zero exit status 1.

MilesCranmer commented 8 months ago

Hi @PaulGersberg, That looks like a different issue. The 3.12 incompatibility is specifically related to how imports work in PyJulia (which was introduced in 3.12.0, but not earlier). Cheers, Miles

MilesCranmer commented 6 months ago

Fixed with PyJulia 0.6.2: https://github.com/JuliaPy/pyjulia/releases/tag/v0.6.2

MilesCranmer commented 4 months ago

Fixed by #535 (for good this time)