简体   繁体   中英

Julia `Pkg.checkout` causing `UndefVarError: checkout not defined`

I am installing a package using Pkg module:

using Pkg
Pkg.add("DataFrames")
Pkg.checkout("Flux")  # for the bleeding edge version of Flux

and it fails with:

 Updating registry at `~/.julia/registries/General`
  Updating git-repo `git://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed InvertedIndices ─ v1.0.0
 Installed PooledArrays ──── v0.5.3
 Installed DataFrames ────── v0.20.2
  Updating `~/.julia/environments/v1.3/Project.toml`
  [a93c6f00] + DataFrames v0.20.2
  Updating `~/.julia/environments/v1.3/Manifest.toml`
  [a93c6f00] + DataFrames v0.20.2
  [41ab1584] + InvertedIndices v1.0.0
  [2dfb63ee] + PooledArrays v0.5.3

UndefVarError: checkout not defined

Stacktrace:
 [1] getproperty(::Module, ::Symbol) at ./Base.jl:13
 [2] top-level scope at In[1]:3

How to fix it?

My Julia environment:

julia> versioninfo()

Julia Version 1.3.1
Commit 2d5741174c (2019-12-30 21:36 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.6.0)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 4

As per documentation starting with Julia v. 1.0 Pkg does no longer support checkout function. You can do the same (and leaner - not checking out the whole repository) using:

Pkg.add(PackageSpec(name="Flux", rev="master"))   # you can use commit hash too

Which is equivalent to:

julia> ]
pkg> add Flux#master

You can also use a particular version of the library:

julia> ]
pkg> add Flux@v0.10.3

(equivalent to: Pkg.add(PackageSpec(name="Flux", version="v0.10.3") )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM