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

Unhelpful error message when not importing the correct packages #232

Closed
IlianPihlajamaa opened this issue Feb 15, 2024 · 3 comments · Fixed by #236
Closed

Unhelpful error message when not importing the correct packages #232

IlianPihlajamaa opened this issue Feb 15, 2024 · 3 comments · Fixed by #236

Comments

@IlianPihlajamaa
Copy link
Contributor

IlianPihlajamaa commented Feb 15, 2024

If I run the following code

using Integrals # Here I forget to include Cuba

f(x, p) = sum(sin.(x))
domain = (ones(2), 3ones(2)) # (lb, ub)
prob = IntegralProblem(f, domain)
sol = Integrals.solve(prob, CubaVegas(), reltol = 1e-3, abstol = 1e-3)

I get the error message:

ERROR: MethodError: no method matching __solvebp_call(::IntegralProblem{…}, ::CubaVegas, ::Integrals.ReCallVJP{…}, ::Tuple{…}, ::SciMLBase.NullParameters; reltol::Float64, abstol::Float64)
An arithmetic operation was performed on a NullParameters object. This means no parameters were passed
into the AbstractSciMLProblem (e.x.: ODEProblem) but the parameters object `p` was used in an arithmetic
expression. Two common reasons for this issue are:

1. Forgetting to pass parameters into the problem constructor. For example, `ODEProblem(f,u0,tspan)` should
be `ODEProblem(f,u0,tspan,p)` in order to use parameters.

2. Using the wrong function signature. For example, with `ODEProblem`s the function signature is always
`f(du,u,p,t)` for the in-place form or `f(u,p,t)` for the out-of-place form. Note that the `p` argument
will always be in the function signature regardless of if the problem is defined with parameters!

I don't know the internals of SciML well enough to understand why I get this error, but perhaps this situation could be added to the list in the error message? Or is there a better solution?

@ChrisRackauckas
Copy link
Member

What version of Integrals and SciMLBase?

@IlianPihlajamaa
Copy link
Contributor Author

What version of Integrals and SciMLBase?

Integrals: "4.3.0"
SciMLBase: "2.26.0"

I get this error in a blank environment with just Cuba.jl and Integrals.jl installed

@ChrisRackauckas
Copy link
Member

Oh I see, because the extension isn't loaded. Yeah we can make a better error message for that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants