MilesCranmer / PySR

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

[BUG] Julia updating even when `update=False` #185

Closed aminravanbakhsh closed 2 years ago

aminravanbakhsh commented 2 years ago

Hi, I hope you are doing well. I used PySR to solve the example on the PySR github page. However, each time I run the code, it upgrades Julia. I would appreciate it if you could tell me what the problem is. It is worth mentioning that I use a virtual environment for my code. You can see the results below.

Version (please include the following information):

Screenshot from 2022-09-04 18-59-58 Screenshot from 2022-09-04 18-58-18

MilesCranmer commented 2 years ago

Hi @aminravanbakhsh, This is normal behaviour. It is updating packages, not updating Julia itself.

You can disable this behaviour with update=False.

Also note that this only occurs the first time you run fit(X, y) in a Python process. Subsequent calls will not do this. If you quit and re-open Python, it will happen again.

Best, Miles

aminravanbakhsh commented 2 years ago

Hi Miles, Thanks for your response. However, I used "update = False" and it didn't work. Do you have any other ideas about this?

Regards, Amin

MilesCranmer commented 2 years ago

Okay, that seems like a mistake. I just looked and indeed Pkg.instantiate() is called even when update=False.

I pushed a fix to master.

Can you try with the version on master? i.e., pip install -U git+https://github.com/MilesCranmer/PySR.git@master.

Note that since this is a new version, the first time you run it, you need to have update=True, so that the new environment can be installed. Subsequent calls can have update=False, though.

aminravanbakhsh commented 2 years ago

Thanks for your attention. Unfortunately it didn't work for me. Do you have any other ideas?

MilesCranmer commented 2 years ago

Can you try now? (i.e., re-run the pip install?)

Note that it will still display the Activating project message. It shouldn't display the Updating registry message now though.

aminravanbakhsh commented 2 years ago

Unfortunately it didn't work too. I tried to reinstall the PySR. I received this warning, maybe it could help.

Screenshot from 2022-09-06 12-16-31

MilesCranmer commented 2 years ago

@aminravanbakhsh can you be more specific about what’s not working? From my test it seems like everything is good to go.

aminravanbakhsh commented 2 years ago

I am just saying that every time I run the code, it updates the registry, even when I reinstalled the PySR. I am just using a virtual environment on my Ubuntu 20.04.

MilesCranmer commented 2 years ago

It might not have updated your pysr since it is the same version before and after the fix. Can you run pip uninstall pysr && pip install -U git+https://github.com/MilesCranmer/PySR.git@master?

You are using update=False, right?

aminravanbakhsh commented 2 years ago

Thanks for your helps Miles! It worked and I didn't receive the update message. However, it took a lot of time to start the process. Is it OK? Moreover, I am interested in how PySR works. Is there any paper that describes the PySR algorithm?

MilesCranmer commented 2 years ago

Awesome - yeah the first time you run it will take a while since Julia is compiling the backend. The second time you call .fit() (within the same Python instance) will be much faster though.

Paper out soon!