LoadError: UndefVarError: Penalty not defined

Hello, I want to adapt parameters of a differential equation to available data on a computer with julia 1.4.1 on a linux system. julia 1.4.0 has the same problem.

Running
using DifferentialEquations
using Plots

is o.K. but using DiffEqParamEstim results into an error: I start the REPL with julia and then input

using DiffEqParamEstim

with results:
[ Info: Precompiling DiffEqParamEstim [1130ab10-4a5a-5621-a13d-e4788d82bd4c]
WARNING: could not import LearnBase.prox into PenaltyFunctions
WARNING: could not import LearnBase.prox! into PenaltyFunctions
WARNING: could not import LearnBase.addgrad! into PenaltyFunctions
WARNING: could not import LearnBase.scaled into PenaltyFunctions
ERROR: LoadError: UndefVarError: Penalty not defined
Stacktrace:
[1] top-level scope at /home/ad08/.julia/packages/PenaltyFunctions/6Cxmi/src/PenaltyFunctions.jl:37
[2] include(::Module, ::String) at ./Base.jl:377
[3] top-level scope at none:2
[4] eval at ./boot.jl:331 [inlined]
[5] eval(::Expr) at ./client.jl:449
[6] top-level scope at ./none:3
in expression starting at /home/ad08/.julia/packages/PenaltyFunctions/6Cxmi/src/PenaltyFunctions.jl:37
ERROR: LoadError: Failed to precompile PenaltyFunctions [06bb1623-fdd5-5ca2-a01c-88eae3ea319e] to /home/ad08/.julia/compiled/v1.4/PenaltyFunctions/RxfJh_O8MUa.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[3] _require(::Base.PkgId) at ./loading.jl:1029
[4] require(::Base.PkgId) at ./loading.jl:927
[5] require(::Module, ::Symbol) at ./loading.jl:922
[6] include(::Module, ::String) at ./Base.jl:377
[7] top-level scope at none:2
[8] eval at ./boot.jl:331 [inlined]
[9] eval(::Expr) at ./client.jl:449
[10] top-level scope at ./none:3
in expression starting at /home/ad08/.julia/packages/DiffEqParamEstim/vV8rW/src/DiffEqParamEstim.jl:2
ERROR: Failed to precompile DiffEqParamEstim [1130ab10-4a5a-5621-a13d-e4788d82bd4c] to /home/ad08/.julia/compiled/v1.4/DiffEqParamEstim/nWq0E_O8MUa.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1272
[3] _require(::Base.PkgId) at ./loading.jl:1029
[4] require(::Base.PkgId) at ./loading.jl:927
[5] require(::Module, ::Symbol) at ./loading.jl:922

I have no idea what is wrong. Shall I downgrade to julia-0.7.0 ? REQUIRE in PenaltyFunctions includes the row
julia 0.7-beta.

2 Likes

I would first try a Pkg.update(). The most recent version of PenaltyFunctions doesn’t have a REQUIRE file (replaced with Project.toml).

Thank you, but Pkg.update has no measurable effect. All seems to find, but PenaltyFunctions is unchanged. Do you know, where I can find a new version of PenaltyFunctions?

Can you share your Pkg.status()?

My Pkg.status() is:
julia> Pkg.status()
Status ~/.julia/environments/v1.4/Project.toml
[15425d4b] BitFloats v0.0.3
[a134a8b2] BlackBoxOptim v0.5.0
[159f3aea] Cairo v1.0.3
[5ae59095] Colors v0.12.0
[1130ab10] DiffEqParamEstim v1.13.0
[0c46a032] DifferentialEquations v6.13.0
[7f8f8fb0] LearnBase v0.4.0
[429524aa] Optim v0.20.6
[06bb1623] PenaltyFunctions v0.1.2
[91a5bcdd] Plots v0.29.9
[731186ca] RecursiveArrayTools v2.3.1
[276daf66] SpecialFunctions v0.10.0

The current release of PenaltyFunctions is 0.2.1. I don’t see any packages there that would be holding it back from upgrading, so I’m not sure what’s going on.

What happens if you do

]add PenaltyFunctions@0.2.1

?

@dpsanders
Maybe the result is more informative:

(@v1.4) pkg> add PenaltyFunctions@0.2.1
Updating registry at ~/.julia/registries/General
Updating git-repo https://github.com/JuliaRegistries/General.git
Resolving package versions…
ERROR: Unsatisfiable requirements detected for package DiffEqParamEstim [1130ab10]:
DiffEqParamEstim [1130ab10] log:
β”œβ”€possible versions are: [1.2.0, 1.3.0-1.3.1, 1.4.0, 1.5.0-1.5.1, 1.6.0, 1.7.1, 1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0] or uninstalled
β”œβ”€restricted to versions * by an explicit requirement, leaving only versions [1.2.0, 1.3.0-1.3.1, 1.4.0, 1.5.0-1.5.1, 1.6.0, 1.7.1, 1.8.0, 1.9.0, 1.10.0, 1.11.0, 1.12.0, 1.13.0]
└─restricted by compatibility requirements with PenaltyFunctions [06bb1623] to versions: uninstalled β€” no versions left
└─PenaltyFunctions [06bb1623] log:
β”œβ”€possible versions are: [0.1.0-0.1.2, 0.2.0-0.2.1] or uninstalled
└─restricted to versions 0.2.1 by an explicit requirement, leaving only versions 0.2.1

I think this is telling us what the problem is, but I’m not skilled enough at reading these outputs to know what it is.

An alternative idea is to create a new directory and then inside that directory run Julia and do

] activate myproject

That will create a new empty project that is independent. Then try adding there the packages that you need.

I’m having the exact same problem… no luck downgrading DifferentialEquations yet :confused:

(EDIT) It seems that the problem is in the LearnBase package… try this downgrade

]add LearnBase@0.3

it worked for me!

@brunopjacob
Unfortunately it doesn’t work for me. I shall try to generate my .julia directory completely new.
Many thanks.

@brunopjacob
My last reply is imprecise. I still cannot upgrade PenaltyFunctions to v.0.2.1. But my original program is running now.
I think that the problem with Learnbase is not solved, I don’t know if I need it anymore, but for the moment I can do my work.
Many thanks again.

Maybe the problem is that

]add DiffEqParamEstim

downgrades PenaltyFunctions. To resolve the problem I started with an empty local .julia directory and got the following output for adding some packages:
After
add DifferentialEquations
add Plots
add LinearAlgebra

I added:

(@v1.4) pkg> add PenaltyFunctions
Resolving package versions…
Installed PenaltyFunctions ─ v0.2.1
Installed LearnBase ──────── v0.4.0
Updating ~/.julia/environments/v1.4/Project.toml
[06bb1623] + PenaltyFunctions v0.2.1
Updating ~/.julia/environments/v1.4/Manifest.toml
[7f8f8fb0] + LearnBase v0.4.0
[06bb1623] + PenaltyFunctions v0.2.1

@v1.4) pkg> add DiffEqParamEstim
Resolving package versions…
Installed MKL_jll ──────────────── v2019.0.117+2
Installed PenaltyFunctions ─────── v0.1.2
Installed QuadGK ───────────────── v2.3.1
Installed OptimBase ────────────── v2.0.1
Installed Arpack ───────────────── v0.4.0
Installed DiffEqParamEstim ─────── v1.13.0
Installed Rmath_jll ────────────── v0.2.2+0
Installed Distributions ────────── v0.22.6
Installed DiffEqSensitivity ────── v6.13.0
Installed ReverseDiff ──────────── v1.2.0
Installed Tracker ──────────────── v0.2.6
Installed Arpack_jll ───────────── v3.5.0+3
Installed FFTW ─────────────────── v1.2.0
Installed Sobol ────────────────── v1.3.0
Installed IntelOpenMP_jll ──────── v2018.0.3+0
Installed QuasiMonteCarlo ──────── v0.2.0
Installed FFTW_jll ─────────────── v3.3.9+5
Installed Calculus ─────────────── v0.5.1
Installed StatsFuns ────────────── v0.8.0
Installed Rmath ────────────────── v0.6.1
Installed LsqFit ───────────────── v0.10.0
Installed PDMats ───────────────── v0.9.12
Installed Dierckx ──────────────── v0.4.1
Installed StatsBase ────────────── v0.32.2
Installed Zygote ───────────────── v0.4.16
Installed AbstractFFTs ─────────── v0.5.0
Installed NNlib ────────────────── v0.6.6
Installed IRTools ──────────────── v0.3.2
Installed LatinHypercubeSampling ─ v1.6.4
Downloading artifact: Rmath
######################################################################## 100,0%##O=# Downloading artifact: Arpack
######################################################################## 100,0%##O=# Downloading artifact: FFTW
######################################################################## 100,0%##O=# Downloading artifact: IntelOpenMP
######################################################################## 100,0%##O=# Updating ~/.julia/environments/v1.4/Project.toml
[1130ab10] + DiffEqParamEstim v1.13.0
[06bb1623] ↓ PenaltyFunctions v0.2.1 β‡’ v0.1.2
Updating ~/.julia/environments/v1.4/Manifest.toml
[621f4979] + AbstractFFTs v0.5.0
[7d9fca2a] + Arpack v0.4.0
[68821587] + Arpack_jll v3.5.0+3
[49dc2e85] + Calculus v0.5.1
[39dd38d3] + Dierckx v0.4.1
[1130ab10] + DiffEqParamEstim v1.13.0
[41bf760c] + DiffEqSensitivity v6.13.0
[31c24e10] + Distributions v0.22.6
[7a1cc6ca] + FFTW v1.2.0
[f5851436] + FFTW_jll v3.3.9+5
[7869d1d1] + IRTools v0.3.2
[1d5cc7b8] + IntelOpenMP_jll v2018.0.3+0
[a5e1c1ea] + LatinHypercubeSampling v1.6.4
[2fda8390] + LsqFit v0.10.0
[856f044c] + MKL_jll v2019.0.117+2
[872c559c] + NNlib v0.6.6
[87e2bd06] + OptimBase v2.0.1
[90014a1f] + PDMats v0.9.12
[06bb1623] ↓ PenaltyFunctions v0.2.1 β‡’ v0.1.2
[1fd47b50] + QuadGK v2.3.1
[8a4e6c94] + QuasiMonteCarlo v0.2.0
[37e2e3b7] + ReverseDiff v1.2.0
[79098fc4] + Rmath v0.6.1
[f50d1b31] + Rmath_jll v0.2.2+0
[ed01d8cd] + Sobol v1.3.0
[2913bbd2] ↓ StatsBase v0.33.0 β‡’ v0.32.2
[4c63d2b9] + StatsFuns v0.8.0
[9f7883ad] + Tracker v0.2.6
[e88e6eb3] + Zygote v0.4.16
Building FFTW ───→ ~/.julia/packages/FFTW/qqcBj/deps/build.log
Building Dierckx β†’ ~/.julia/packages/Dierckx/9SY4A/deps/build.log
Building NNlib ──→ ~/.julia/packages/NNlib/FAI3o/deps/build.log

with the result that PenaltyFunctions and StatsBase were downgraded.

I don’t know if there is a workaround, I shall use my old .julia directory, which at least works.

1 Like

Wait 1 hour and then update.

1 Like

update

I just updated.

using DiffEqParamEstim

now seems to be o.k. I only got the following warnings. Don’t know if they are relevant.
julia> using DiffEqParamEstim
[ Info: Precompiling DiffEqParamEstim [1130ab10-4a5a-5621-a13d-e4788d82bd4c]
β”Œ Warning: lgamma(x::Real) is deprecated, use (logabsgamma(x))[1] instead.
β”‚ caller = lstirling_asym(::BigFloat) at misc.jl:56
β”” @ StatsFuns ~/.julia/packages/StatsFuns/2QE7p/src/misc.jl:56
WARNING: could not import LearnBase.prox into PenaltyFunctions
WARNING: could not import LearnBase.prox! into PenaltyFunctions
WARNING: could not import LearnBase.addgrad! into PenaltyFunctions
WARNING: could not import LearnBase.scaled into PenaltyFunctions

My status now is:
[a134a8b2] BlackBoxOptim v0.5.0
[1130ab10] DiffEqParamEstim v1.14.0
[0c46a032] DifferentialEquations v6.13.0
[7f8f8fb0] LearnBase v0.4.0
[429524aa] Optim v0.20.6
[06bb1623] PenaltyFunctions v0.2.1
[91a5bcdd] Plots v1.1.0
[731186ca] RecursiveArrayTools v2.3.1
[37e2e46d] LinearAlgebra

Thank you for your work.

Short remark: The warnings concerning LearnBase now have disappeared. I don’t know why.