Missing functions in Zygote

I am trying to use the jacobian functions in Zygote, but I can’t find them. In what has to be the dumbest questions ever posted here, there’s very little in Zygote for me. Heres the problem:

julia> using Zygote

julia> names(Zygote)

5-element Array{Symbol,1}:

Symbol(“@code_grad”)

:Params

:Zygote

:gradient

:pullback

julia> Zygote.withjacobian

ERROR: UndefVarError: withjacobian not defined

Stacktrace:

[1] getproperty( ::Module, ::Symbol ) at ./Base.jl:26

[2] top-level scope at REPL[3]:1

Here the Zygote API: Utilities · Zygote

Where are the missing methods?

If I had to guess, you have a old version of Zygote installed. Anything under 0.6.20 or even 0.6.30 will probably not have those functions.

I got this on updating

(@v1.5) pkg> update Zygote

Updating registry at ~/.julia/registries/General

######################################################################## 100.0%

Installed StatsFuns ─ v0.9.15

No Changes to ~/.julia/environments/v1.5/Project.toml

Updating ~/.julia/environments/v1.5/Manifest.toml

[4c63d2b9] ↑ StatsFuns v0.9.14 ⇒ v0.9.15

julia> using Zygote

julia> names(Zygote)

5-element Array{Symbol,1}:

Symbol(“@code_grad”)

:Params

:Zygote

:gradient

:pullback

julia> Zygote.jacobian

ERROR: UndefVarError: jacobian not defined

Stacktrace:

[1] getproperty( ::Module, ::Symbol ) at ./Base.jl:26

[2] top-level scope at REPL[6]:1

What is the output if you enter:

pkg> st

?

[e88e6eb3] Zygote v0.4.20

which clearly is not the version I need for the functions (didnt know about st, thank you so much!).
Let me try updating Julia and seeing if “update Zygote” actually bumps up the version.

It is more likely that some other package you have installed is holding Zygote back rather than the Julia executable being too old. Try updating all packages first:

pkg> up

If that doesn’t work, ask for the specific Zygote version you want and hopefully you will get an error describing the package that is holding it back:

pkg> add Zygote@0.6.34

I update Julia and it solved the problem (thanks everyone) - but to answer @contradict I went back to 1.5, did up and then add Zygote@0.6.34 and got this

ERROR: Unsatisfiable requirements detected for package Distributions [31c24e10]:
Distributions [31c24e10] log:
├─possible versions are: [0.16.0-0.16.4, 0.17.0, 0.18.0, 0.19.1-0.19.2, 0.20.0, 0.21.0-0.21.3, 0.21.5-0.21.12, 0.22.0-0.22.6, 0.23.0-0.23.12, 0.24.0-0.24.18, 0.25.0-0.25.41] or uninstalled
├─restricted to versions 0.18-0.25 by CircStats [0643c194], leaving only versions [0.18.0, 0.19.1-0.19.2, 0.20.0, 0.21.0-0.21.3, 0.21.5-0.21.12, 0.22.0-0.22.6, 0.23.0-0.23.12, 0.24.0-0.24.18, 0.25.0-0.25.41]
│ └─CircStats [0643c194] log:
│ ├─possible versions are: 0.2.1 or uninstalled
│ └─CircStats [0643c194] is fixed to version 0.2.1
├─restricted by compatibility requirements with VectorizedRoutines [0e69188a] to versions: [0.16.0-0.16.4, 0.17.0, 0.18.0, 0.19.1-0.19.2, 0.20.0, 0.21.0-0.21.3, 0.21.5-0.21.12, 0.22.0-0.22.6, 0.23.0-0.23.12], leaving only versions: [0.18.0, 0.19.1-0.19.2, 0.20.0, 0.21.0-0.21.3, 0.21.5-0.21.12, 0.22.0-0.22.6, 0.23.0-0.23.12]
│ └─VectorizedRoutines [0e69188a] log:
│ ├─possible versions are: 0.1.0 or uninstalled
│ └─restricted to versions * by an explicit requirement, leaving only versions 0.1.0
└─restricted by compatibility requirements with SpecialFunctions [276daf66] to versions: [0.24.4-0.24.18, 0.25.0-0.25.41] or uninstalled — no versions left
└─SpecialFunctions [276daf66] log:
├─possible versions are: [0.7.0-0.7.2, 0.8.0, 0.9.0, 0.10.0-0.10.3, 1.0.0, 1.1.0, 1.2.0-1.2.1, 1.3.0, 1.4.0-1.4.2, 1.5.0-1.5.1, 1.6.0-1.6.2, 1.7.0, 1.8.0-1.8.1, 2.0.0] or uninstalled
├─restricted by compatibility requirements with ForwardDiff [f6369f11] to versions: [0.7.0-0.7.2, 0.8.0, 0.9.0, 0.10.0-0.10.3, 1.0.0, 1.1.0, 1.2.0-1.2.1, 1.3.0, 1.4.0-1.4.2, 1.5.0-1.5.1, 1.6.0-1.6.2, 1.7.0, 1.8.0-1.8.1, 2.0.0]
│ └─ForwardDiff [f6369f11] log:
│ ├─possible versions are: [0.9.0, 0.10.0-0.10.25] or uninstalled
│ ├─restricted to versions * by an explicit requirement, leaving only versions [0.9.0, 0.10.0-0.10.25]
│ └─restricted by compatibility requirements with Zygote [e88e6eb3] to versions: 0.10.0-0.10.25
│ └─Zygote [e88e6eb3] log:
│ ├─possible versions are: [0.1.0, 0.2.0, 0.3.0-0.3.4, 0.4.0-0.4.22, 0.5.0-0.5.17, 0.6.0-0.6.34] or uninstalled
│ └─restricted to versions 0.6.34 by an explicit requirement, leaving only versions 0.6.34
├─restricted by compatibility requirements with Zygote [e88e6eb3] to versions: [1.6.0-1.6.2, 1.7.0, 1.8.0-1.8.1, 2.0.0]
│ └─Zygote [e88e6eb3] log: see above
└─restricted by compatibility requirements with AutoGrad [6710c13c] to versions: [0.7.0-0.7.2, 0.8.0, 0.9.0, 0.10.0-0.10.3, 1.0.0, 1.1.0, 1.2.0-1.2.1, 1.3.0, 1.4.0-1.4.2, 1.5.0-1.5.1, 1.6.0-1.6.2, 1.7.0, 1.8.0-1.8.1], leaving only versions: [1.6.0-1.6.2, 1.7.0, 1.8.0-1.8.1]
└─AutoGrad [6710c13c] log:
├─possible versions are: [1.0.0-1.0.1, 1.1.0-1.1.6, 1.2.0-1.2.4] or uninstalled
└─restricted to versions * by an explicit requirement, leaving only versions [1.0.0-1.0.1, 1.1.0-1.1.6, 1.2.0-1.2.4]