MilesCranmer / PySR

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

Self-repairing incremental installs #363

Closed MilesCranmer closed 1 year ago

MilesCranmer commented 1 year ago

@mkitti I wonder if there is some way to do this automatically https://github.com/MilesCranmer/PySR/issues/257

TODO:

MilesCranmer commented 1 year ago

Could also do this automatically with

subprocess.call(
    ["julia", "-e", 'rm(joinpath(first(DEPOT_PATH), "packages", "PyCall"), recursive=true)']
)

followed by re-trying julia.install. But I'm not sure if that is potentially dangerous or not. Wdyt @mkitti?

mkitti commented 1 year ago

Umm, what's the primary issue. Is this new to Julia 1.9?

MilesCranmer commented 1 year ago

This issue has been around for a while. It seems to be related to when you update your Python or Julia version, and try to re-install PyJulia, some install preferences stored in PyCall are violated.

mkitti commented 1 year ago

This an environment issue:

ERROR: LoadError: The following package names could not be resolved: * PyCall (not found in project or manifest)

It is missing the UUID.

MilesCranmer commented 1 year ago

Cool!

Screenshot 2023-07-02 at 8 09 36 PM

Automatically patches that PyCall error 🥳

xukai92 commented 1 year ago

Hi Cranmer, I came from the https://github.com/JuliaPy/PyCall.jl/pull/945 (I was looking into a similar issue a while back). Just wonder if you have checked https://cjdoris.github.io/PythonCall.jl/stable/juliacall/, which is an alternative to PyJulia that seems to have better Python/Julia environment/version support.

Btw, really like your works on neural-symbolic methods for physics. I have been following them and also did something related :)

MilesCranmer commented 1 year ago

Thanks and thanks for sending your exciting paper! Very cool stuff.

Yes I'm indeed interested in potentially switching to juliacall. From what I've seen the installation process is much nicer, and so it would be great to have it as the PySR -> Julia interface. Just need someone to try 🙏 🙏 . The API is pretty similar so it shouldn't be too bad to switch (basically just jl.eval -> jl.seval; and then removing julia_helpers.py). The only downsides are that (1) it's fairly new whereas PyJulia has been around for a while and is "battle-tested", and (2) it doesn't sound like it can eliminate the precompilation issue we've been fighting for a while with static python installations (like conda). I'm not sure if (1) is an issue in practice though because juliacall is more Julia-heavy (rather than the Python-heavy PyJulia), so it's is probably safer to use longterm and has other advantages.