MilesCranmer / PySR

High-Performance Symbolic Regression in Python and Julia

Home Page:https://astroautomata.com/PySR

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quitting pySR

shikharmittal04 opened this issue · comments

Describe the bug
I have been trying the example given in the introduction section. Equations were printed after the command model.fit(X, y). However, I am facing the relatively simple issue of quitting the run. As given in the docs, I type q and press enter but nothing happens after that. Am I misinterpreting something?

The following message appeared before equations were printed
Message
``
/home/shikhar/.local/lib/python3.8/site-packages/pysr/sr.py:291: UserWarning:
Your Python version is statically linked to libpython. For example, this could be the python included with conda, or maybe your system's built-in python.
This will still work, but the precompilation cache for Julia will be turned off, which may result in slower startup times on the initial pysr() call.

To install a Python version that is dynamically linked to libpython, pyenv is recommended (https://github.com/pyenv/pyenv).

To silence this warning, you can run pysr.silence_julia_warning() after importing pysr.
warnings.warn(

Activating project at /tmp/tmpqggvkrhd
Updating /tmp/tmpqggvkrhd/Project.toml
[8254be44] + SymbolicRegression v0.7.6
Updating /tmp/tmpqggvkrhd/Manifest.toml
[c3fe647b] + AbstractAlgebra v0.12.0
[4fba245c] + ArrayInterface v4.0.2
[d360d2e6] + ChainRulesCore v1.12.0
[9e997f8a] + ChangesOfVariables v0.1.2
[861a8166] + Combinatorics v1.0.2
[bbf7d656] + CommonSubexpressions v0.3.0
[34da2185] + Compat v3.41.0
[9a962f9c] + DataAPI v1.9.0
[864edb3b] + DataStructures v0.18.11
[163ba53b] + DiffResults v1.0.3
[b552c78f] + DiffRules v1.9.1
[ffbed154] + DocStringExtensions v0.8.6
[e2ba6199] + ExprTools v0.1.8
[1a297f60] + FillArrays v0.12.7
[6a86dc24] + FiniteDiff v2.10.0
[f6369f11] + ForwardDiff v0.10.25
[ff7dd447] + FromFile v0.1.2
[615f187c] + IfElse v0.1.1
[3587e190] + InverseFunctions v0.1.2
[92d709cd] + IrrationalConstants v0.1.1
[692b3bcd] + JLLWrappers v1.4.1
[0f8b85d8] + JSON3 v1.9.2
[7f8f8fb0] + LearnBase v0.4.1
[d3d80556] + LineSearches v7.1.1
[2ab3a3ac] + LogExpFunctions v0.3.6
[30fc2ffe] + LossFunctions v0.7.2
[1914dd2f] + MacroTools v0.5.9
[e1d29d7a] + Missings v1.0.2
[d41bc354] + NLSolversBase v7.8.2
[77ba4419] + NaNMath v0.3.7
[429524aa] + Optim v1.6.0
[bac558e1] + OrderedCollections v1.4.1
[d96e819e] + Parameters v0.12.3
[69de0a69] + Parsers v2.2.1
[85a6dd25] + PositiveFactorizations v0.2.4
[21216c6a] + Preferences v1.2.3
[fb686558] + RandomExtensions v0.4.3
[3cdcf5f2] + RecipesBase v1.2.1
[189a3867] + Reexport v1.2.2
[ae029012] + Requires v1.3.0
[a2af1166] + SortingAlgorithms v1.0.1
[276daf66] + SpecialFunctions v1.8.1
[aedffcd0] + Static v0.5.1
[90137ffa] + StaticArrays v1.3.3
[82ae8749] + StatsAPI v1.2.0
[2913bbd2] + StatsBase v0.33.14
[856f2bd8] + StructTypes v1.8.1
[8254be44] + SymbolicRegression v0.7.6
[d1185830] + SymbolicUtils v0.6.3
[a759f4b9] + TimerOutputs v0.5.15
[3a884ed6] + UnPack v1.0.2
[efe28fd5] + OpenSpecFun_jll v0.5.5+0
[0dad84c5] + ArgTools
[56f22d72] + Artifacts
[2a0f44e3] + Base64
[ade2ca70] + Dates
[8bb1440f] + DelimitedFiles
[8ba89e20] + Distributed
[f43a241f] + Downloads
[b77e0a4c] + InteractiveUtils
[b27032c2] + LibCURL
[76f85450] + LibGit2
[8f399da3] + Libdl
[37e2e46d] + LinearAlgebra
[56ddb016] + Logging
[d6f4376e] + Markdown
[a63ad114] + Mmap
[ca575930] + NetworkOptions
[44cfe95a] + Pkg
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA
[9e88b42a] + Serialization
[1a1011a3] + SharedArrays
[6462fe0b] + Sockets
[2f01184e] + SparseArrays
[10745b16] + Statistics
[fa267f1f] + TOML
[a4e569a6] + Tar
[8dfed614] + Test
[cf7118a7] + UUIDs
[4ec0a83e] + Unicode
[e66e0078] + CompilerSupportLibraries_jll
[deac9b47] + LibCURL_jll
[29816b5a] + LibSSH2_jll
[c8ffd9c3] + MbedTLS_jll
[14a3606d] + MozillaCACerts_jll
[4536629a] + OpenBLAS_jll
[05823500] + OpenLibm_jll
[83775a58] + Zlib_jll
[8e850b90] + libblastrampoline_jll
[8e850ede] + nghttp2_jll
[3f19e933] + p7zip_jll
┌ Warning: vendor() is deprecated, use BLAS.get_config() and inspect the output instead
│ caller = npyinitialize() at numpy.jl:67
└ @ PyCall ~/.julia/packages/PyCall/L0fLP/src/numpy.jl:67
Started!

``

Version
Ubuntu 20.04
julia 1.7.1

Additional context
I am trying this example on the terminal directly.

Is this in ipython or python?

Could you try typing q, then <enter> multiple times?

I note that the quit won't happen immediately; it will take up to a couple seconds to quit, so that the backend has time to collect the current populations.

I also wonder if it could be because your python is statically linked to libpython - maybe julia can't read stdin when this happens? If other things don't work, you could try setting up a dynamically linked python with:

PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.10

(after installing pyenv).

I am using python. Thanks for the suggestions. I installed pyenv following the procedure on the page https://www.liquidweb.com/kb/how-to-install-pyenv-on-ubuntu-18-04/.
I also did PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.10 but I still get the same warning. And q +enter doesn't quit the run.

I'm not sure where this error is coming from, sorry. If I could reproduce it I could take a look at this but I don't see this behavior on any of my machines so I'm not sure where to start. Maybe you could try to write a python unittest for this?

Here are the current tests:
https://github.com/MilesCranmer/PySR/blob/master/test/test.py

The run on ubuntu, macOS, and Windows. If a test breaks on one of these systems, I can try to debug it from there?

Hi, I have to run this code as it is, right? Should there be any output or something, because the code did run with no errors?

Oh, sorry, what I mean is to try to add a new test to test.py that tests the behavior you've seen. It would basically need to manually send 'q' through stdin to stop a test early.
This is a bit of work but I don't have the time to add it right now. I can look later, but in the meantime, if you would like, you could try setting this up?