PySR icon indicating copy to clipboard operation
PySR copied to clipboard

[BUG]: Freezing/Getting Stuck on Python 3.7/PySR 0.18.3

Open amirhszd opened this issue 1 year ago • 24 comments

What happened?

Hi there, I have not been able to find a similar issue to this. It is probably something silly. But I am running on Python 3.7, on larger number of iterations and bigger datasets (2000 samples with 3 features), the progress print gets stuck at "compiling Julia backend" or in the middle of the optimization. I am using the very basic functionality code in the readme file, so nothing crazy. Any ideas?

Thanks, Amir

Version

0.18.3

Operating System

macOS

Package Manager

Conda

Interface

Script (i.e., python my_script.py)

Relevant log output

Compiling Julia backend...
[ Info: Started!
2.4%┣██                                                                                  ┫ 71/3.0k [00:02<01:07, 44it/s]Expressions evaluated per second: 7.85e+04. Head worker occupation: 22.4%                                               Press 'q' and then <enter> to stop execution early.                                                                     Hall of Fame:                                                                                                           ----------------------------------------------------------------------------------------------------------------------- Complexity  Loss       Score     Equation                                                                               1           6.077e-01  1.594e+01  y = x2                                                                                2           6.057e-01  3.288e-03  y = cube(-0.33556)                                                                    3           5.736e-01  5.450e-02  y = -0.18654 * x1                                                                     4           5.716e-01  3.527e-03  y = cube(-0.21912 * x1)                                                               5           5.017e-01  1.303e-01  y = 0.24248 * (x0 - x1)                                                               6           3.090e-01  4.849e-01  y = cube(0.33309 * (x0 - x1))                                                         8           2.241e-01  1.606e-01  y = 0.24248 * (square(x0 - x1) - x0)                                                  12          2.219e-01  2.427e-03  y = ((square(x0 - x1) + (x2 - x1)) * 0.21079) + -0.24809                              14          2.136e-01  1.898e-02  y = 0.24248 * (((square((x0 - x1) - -0.17614) - x0) - 1.3057) - -0.22216)             16          2.097e-01  9.353e-03  y = (x2 + ((0.1745 * 1.3059) * (square(x1 - x0) - (0.54558 * x1)))) + -0.34857        17          2.013e-01  4.082e-02  y = (((square(x0 - x1) + x2) * 0.21079) - square((0.096751 * -2.0963) * x1)) + -0....                                   24809                                                                                 19          1.975e-01  9.550e-03  y = (((square(x0 - x1) + x2) * 0.21079) - square(((0.096751 * x0) * x1) * 0.57378)...                                   ) + -0.24809                                                                          20          1.954e-01  1.073e-02  y = (((square(inv(-0.7479)) * square((x0 + -0.34297) - x1)) - x1) * (-0.083091 * i...                                   nv(cube(-0.82306)))) - 0.2591

Extra Info

No response

amirhszd avatar Feb 18 '25 23:02 amirhszd

Hi @amirhszd, Are you able to use a newer Python? Python 3.7 stopped receiving security updates 1.5 years ago, so is no longer recommended to use in any context:

Image

The most recent PySR version is 1.4.0. This version is only supported on Python 3.10 and above, and will not be available on older Python versions. Are you able to update Python?

Cheers, Miles

MilesCranmer avatar Feb 18 '25 23:02 MilesCranmer

Thank you very much for this!

amirhszd avatar Feb 19 '25 14:02 amirhszd

Unfortunately, I am still seeing the same behavior with python 3.11. I am able to run it with 500 iterations and sampling 1000 from my dataset, but anything above that freezes.

amirhszd avatar Feb 19 '25 14:02 amirhszd

What version of PySR? Can you update to 1.4?

MilesCranmer avatar Feb 19 '25 14:02 MilesCranmer

Also please share your entire script if possible

MilesCranmer avatar Feb 19 '25 14:02 MilesCranmer

I am using PySR 1.4.

below is my code:

    df = pd.read_csv("data.csv")

    x = np.vstack([df["w"].to_numpy(),
                   df["T1"].to_numpy() - df["T2"].to_numpy(),
                   (df["e1"].to_numpy() + df["e2"].to_numpy())/2, 
                   df["e1"].to_numpy() - df["e2"].to_numpy()]
                  ).T.astype(np.float32) 
    y = df['error'].to_numpy()

    from pysr import PySRRegressor
    model = PySRRegressor(
        maxsize=20,
        niterations=1000,  # < Increase me for better results
        binary_operators=["*", "+", "-", "/"],
        unary_operators=["square", "cube", "inv(x) = 1/x"],
        extra_sympy_mappings={"inv": lambda x: 1 / x},
    )

    indices = np.random.choice(np.arange(len(x)), 1000)
    model.fit(x[indices], y[indices])

amirhszd avatar Feb 19 '25 14:02 amirhszd

Can you share data.csv too? I really am not sure what could cause freezing though. Can you share the entire output from start to finish, even stderr if it is available? And if you monitor the process in the "Activity Monitor", is it still running?

MilesCranmer avatar Feb 19 '25 14:02 MilesCranmer

Hi Miles,

I encountered similar problem. I am using a Python version of 3.10.12, about 5000 data point, 10 features. The parameter is below. When it stuck, I use htop and cannot see it's running. But at beginning I can see it in htop. Do you have idea how to fix this? Thank you in advance.

Cheers Jinning

#log model = PySRRegressor( populations=150, # ^ Assuming we have 4 cores, this means 2 populations per core, so one is always running. Better set a 3proc #population_size=50, ncycles_per_iteration=500, # ^ Generations between migrations. niterations=300, # Run forever early_stop_condition=( "stop_if(loss, complexity) = loss < 1e-4 && complexity < 50" # Stop early if we find a good and simple equation ), timeout_in_seconds=60 * 60 * 8, # ^ Alternatively, stop after 1 hours have passed. maxsize=100, # ^ Allow greater complexity. #maxdepth=10, # ^ But, avoid deep nesting. binary_operators=["","^","+"], unary_operators=["exp","log10"], constraints={ "+": (-1, -1), #"-": (8, 8), "*": (10, 10), #"/": (3, 3), "^": (10, 2), "exp": 10, "log10": 10, #"log10": 3, }, complexity_of_variables=3, # ^ Limit the complexity within each argument. # "inv": (-1, 9) states that the numerator has no constraint, # but the denominator has a max complexity of 9. # "exp": 9 simply states that exp can only have # an expression of complexity 9 as input. nested_constraints={ #"^" : { "exp": 0, "log10": 0, "^":0}, "exp": { "exp": 0, "log10": 0, "^":0}, "log10": { "exp": 0, "log10": 0, "^":0},}, #"log10": { "exp": 0, "log": 0, "log10": 0, "^":0}, #}, # ^ Nesting constraints on operators. For example, # "square(exp(x))" is not allowed, since "square": {"exp": 0}. #complexity_of_operators={"/": 2, "exp": 3}, # ^ Custom complexity of particular operators. complexity_of_constants=1, # ^ Punish constants more than variables #select_k_features=4, # ^ Train on only the 4 most important features progress=True, # ^ Can set to false if printing to a file. #weight_randomize=0.1, # ^ Randomize the tree much more frequently #precision=32, # ^ Higher precision calculations. #turbo=True, # ^ Faster evaluation (experimental), #batching=True, #batch_size=2000, #parallelism="multiprocessing", procs=50, turbo=True, weight_optimize=0.001, elementwise_loss=elementwise_loss, #loss_function=loss_function, #warm_start=True #parsimony=1e-5/5, #weight_optimize=0.001, #bumper=True verbosity=1, )

JinningLianggithub avatar Aug 09 '25 01:08 JinningLianggithub

Could you edit your comment to use the triple backticks? Then it will display as code and be easier to read. Thanks!

MilesCranmer avatar Aug 09 '25 13:08 MilesCranmer

Thanks for reply! It is attached below. I deleted commented lines

model = PySRRegressor(
populations=150,
ncycles_per_iteration=500,
niterations=300, # Run forever
early_stop_condition=(
"stop_if(loss, complexity) = loss < 1e-4 && complexity < 50"
),
timeout_in_seconds=60 * 60 * 8,
maxsize=100,
binary_operators=["","^","+"],
unary_operators=["exp","log10"],
constraints={
"+": (-1, -1),
"*": (10, 10),
"^": (10, 2),
"exp": 10,
"log10": 10,
},
complexity_of_variables=3,
nested_constraints={
"exp": { "exp": 0, "log10": 0, "^":0},
"log10": { "exp": 0, "log10": 0, "^":0},
}
complexity_of_constants=1,
progress=True,
procs=50,
turbo=True,
weight_optimize=0.001,
elementwise_loss=elementwise_loss,
verbosity=1,
)

JinningLianggithub avatar Aug 09 '25 14:08 JinningLianggithub

Hm not sure. But what is binary_operators=["","^","+"]? Is the operator not shown?

MilesCranmer avatar Aug 10 '25 04:08 MilesCranmer

It's ["*","^","+"], not sure why it didn't show. Would it be possible that the data is too large? Or the tree is too deep?

JinningLianggithub avatar Aug 11 '25 05:08 JinningLianggithub

How much data is it? You generally only need like a few thousand points, maybe for very complex expressions 10k points but symbolic regression is just not flexible enough to justify more data

MilesCranmer avatar Aug 11 '25 10:08 MilesCranmer

It's just ~5k.

JinningLianggithub avatar Aug 11 '25 13:08 JinningLianggithub

Hi Miles, hope it’s okay if I chime in (I'm just a user of your code): I ran into what sounds like a very similar freeze issue on multiple Windows machines, and I think I may have solved it by setting input_stream to "devnull" in PySRRegressor:

model = PySRRegressor(
    input_stream='devnull',
    #.........
)

In my case, the symptom is that the Python script runs normally for a while (varies from minutes to hours), but it suddenly stops all activity during the optimization without any error messages. It just freezes. I let the PCs running the code overnight, and, in the morning, some of them stopped running. The script resumes execution after pressing “Enter” key in the terminal. “QuickEdit” was disabled on the terminal (I read online that sometimes QuickEdit can lead to this kind of behavior.) I’ve tried different terminals: Command Prompt, PowerShell (even with WSL2 + ubuntu) Tried on different PCs (with different versions of Win11 and Win10), and different Python versions. But, could not find a solution.

I used Process Monitor to check for errors, and it shows the Python process completely idle during the pause. The pause occurs after PySR writes to hall_of_fame.csv files. The last activity before pause involves Julia DLL operations (libjulia-internal.dll, sys.dll). A log below for reference. After this, python is idling:

16:51:59,1923006	python.exe	1040	CloseFile	D:\Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv		SUCCESS
16:51:59,1928158	python.exe	1040	CreateFile	D:\Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv.bak	Desired Access: Generic Write, Read Attributes, Disposition: OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: 0, OpenResult: Overwritten	SUCCESS
16:51:59,1935099	python.exe	1040	QueryNameInformationFile	D:\Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv.bak	Name: \Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv.bak	SUCCESS
16:51:59,1935357	python.exe	1040	QueryBasicInformationFile	D:\Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv.bak	CreationTime: 05/08/2025 16:34:05, LastAccessTime: 05/08/2025 16:51:59, LastWriteTime: 05/08/2025 16:51:59, ChangeTime: 05/08/2025 16:51:59, FileAttributes: A	SUCCESS
16:51:59,1936660	python.exe	1040	WriteFile	D:\Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv.bak	Offset: 0, Length: 878, Priority: Normal	SUCCESS
16:51:59,1938160	python.exe	1040	CloseFile	D:\Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv.bak		SUCCESS
16:51:59,1947563	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1947935	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
16:51:59,1948237	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1948406	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
16:51:59,1948494	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1948801	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1948950	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1949137	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1949584	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1949701	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1949748	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1949822	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1949867	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
16:51:59,1949882	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1949973	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1949993	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1950006	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1950091	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1950098	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1950128	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1950354	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
16:51:59,1950528	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1950626	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
16:51:59,1950678	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
16:51:59,1950758	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1952160	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1952228	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
16:51:59,1952259	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS

Then, if I press “Enter” on the terminal, the script resumes:

17:07:03,2410085	python.exe	1040	QueryNameInformationFile	C:\Users\SupportAdmin\.julia\compiled\v1.11\SymbolicRegression\X2eIS_S1Z0O.dll	Name: \Users	BUFFER OVERFLOW
17:07:03,2410397	python.exe	1040	QueryNameInformationFile	C:\Users\SupportAdmin\.julia\compiled\v1.11\SymbolicRegression\X2eIS_S1Z0O.dll	Name: \Users\SupportAdmin\.julia\compiled\v1.11\SymbolicRegression\X2eIS_S1Z0O.dll	SUCCESS
17:07:03,2455894	python.exe	1040	Thread Create		Thread ID: 4552	SUCCESS
17:07:03,2481451	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2481561	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2481633	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2481763	python.exe	1040	QueryNameInformationFile	C:\Users\SupportAdmin\.julia\compiled\v1.11\DynamicExpressions\BQC8W_S1Z0O.dll	Name: \Users	BUFFER OVERFLOW
17:07:03,2481783	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2482356	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2482433	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
17:07:03,2482718	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2483309	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2483741	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2483756	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2483787	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
17:07:03,2483857	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2484046	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2484103	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2484131	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2484592	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2484641	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2484771	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2484834	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2485110	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2485193	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2485421	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2486118	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
17:07:03,2486126	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2486193	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
17:07:03,2486332	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\bin\libjulia-internal.dll	SUCCESS
17:07:03,2488168	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2488313	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\	BUFFER OVERFLOW
17:07:03,2488510	python.exe	1040	QueryNameInformationFile	C:\Users\SupportAdmin\.julia\compiled\v1.11\DynamicExpressions\BQC8W_S1Z0O.dll	Name: \Users\SupportAdmin\.julia\compiled\v1.11\DynamicExpressions\BQC8W_S1Z0O.dll	SUCCESS
17:07:03,2488575	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2490092	python.exe	1040	QueryNameInformationFile	D:\Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	Name: \Leon\pysr_env_311\julia_env\pyjuliapkg\install\lib\julia\sys.dll	SUCCESS
17:07:03,2681602	python.exe	1040	CreateFile	D:\Leon\outputs\20250805_163327_1J8FbC	Desired Access: Read Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened	SUCCESS
17:07:03,2682488	python.exe	1040	QueryAllInformationFile	D:\Leon\outputs\20250805_163327_1J8FbC	CreationTime: 05/08/2025 16:33:27, LastAccessTime: 05/08/2025 16:56:34, LastWriteTime: 05/08/2025 16:34:05, ChangeTime: 05/08/2025 16:34:05, FileAttributes: D, AllocationSize: 0, EndOfFile: 0	BUFFER OVERFLOW
17:07:03,2682618	python.exe	1040	QueryInformationVolume	D:\Leon\outputs\20250805_163327_1J8FbC	VolumeCreationTime: 25/03/2024 10:47:31, VolumeSerialNumber: D012-E78D, SupportsObjects: True, VolumeLabel: Dat։	BUFFER OVERFLOW
17:07:03,2682720	python.exe	1040	CloseFile	D:\Leon\outputs\20250805_163327_1J8FbC		SUCCESS
17:07:03,2685258	python.exe	1040	CreateFile	D:\Leon\outputs\20250805_163327_1J8FbC\hall_of_fame.csv	Desired Access: Generic Write, Read Attributes, Disposition: OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, Write, AllocationSize: 0, OpenResult: Overwritten	SUCCESS

But I got it working without freezes after reading the (very nicely written!!!!) documentation (inside sr.py):

input_stream : str
  The stream to read user input from. By default, this is `"stdin"`.
  If  you encounter issues with reading from `stdin`, like a hang,
  you can simply pass `"devnull"` to this argument. You can also
  reference an arbitrary Julia object in the `Main` namespace.
  Default is `"stdin"`.

Not sure if it’s directly relevant here, but, yesterday to today, after applying this change, was the first time where all my PCs ran overnight without freezing, so I hope that it might help :)

leonwurr avatar Aug 12 '25 10:08 leonwurr

Ah!! I recognise this. Good thinking with input_stream. Yes, this was added for a similar issue in the backend: https://github.com/MilesCranmer/SymbolicRegression.jl/issues/370 fixed in https://github.com/MilesCranmer/SymbolicRegression.jl/pull/382.

I wish there was a way to automatically detect the conditions for this. Does anybody know? If so, we can just automatically default to devnull for incompatible streams. I had thought it was WSL + VSCode + Jupyter or something but not sure.

MilesCranmer avatar Aug 16 '25 18:08 MilesCranmer

@leonwurr it sounds like you tested this across many windows systems and hit the same issue everywhere. Maybe we should just default to devnull on windows (and WSL) to be safe?

MilesCranmer avatar Aug 16 '25 19:08 MilesCranmer