Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: WARNING: could not import SymbolicRegression.Expression into Main #367

Closed
johnbendi opened this issue Nov 11, 2024 · 2 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@johnbendi
Copy link

What happened?

I get the above warning when try to do:
using SymbolicRegression: Options, Expression, Node

Version

0.23.3

Operating System

Linux

Interface

Jupyter Notebook

Relevant log output

WARNING: could not import SymbolicRegression.Expression into Main

Extra Info

This also happens when running from script or cli:

julia --project=@my_MLJ_env init.jl
WARNING: could not import SymbolicRegression.Expression into Main
ERROR: LoadError: UndefVarError: `Expression` not defined in `Main`
Stacktrace:
 [1] (::var"#1#2")(i::Int64)
   @ Main ./none:0
 [2] iterate
   @ ./generator.jl:48 [inlined]
 [3] collect(itr::Base.Generator{UnitRange{Int64}, var"#1#2"})
   @ Base ./array.jl:780
 [4] top-level scope
   @ ~/experiments/MLJ_jl/init.jl:8
in expression starting at /home/johnbendi/experiments/MLJ_jl/init.jl:8

Content of init.jl:

options = Options(;
    binary_operators=[+, -, *, /], unary_operators=[cos, exp, sin]
)
operators = options.operators
variable_names = ["x1", "x2", "x3"]
x1, x2, x3 = [Expression(Node(Float64; feature=i); operators, variable_names) for i = 1:3]

tree = cos(x1 - 3.2 * x2) - x1 * x1
@johnbendi johnbendi added the bug Something isn't working label Nov 11, 2024
@MilesCranmer
Copy link
Owner

Ah, it's because Expression is only on SymbolicRegression.jl v1.0.0 and up (which are not yet released). To get the beta version of 1.0.0 you can do:

]add SymbolicRegression#master

In the REPL

@johnbendi
Copy link
Author

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants