How to pin a package to previous version on Julia 1.0?

I was following this thread:

But wanted to ask something very specific. Now that 1.0 is released, how can I pin a package to a specific, older version? Here’s a concrete example. On Julia v0.6.4, the following works:

Pkg.pin("Blink", v"0.6.2")
Pkg.pin("PlotlyJS", v"0.10.2")

How could one accomplish the same behavior on Julia v1.0.0 ?

Thats what the help says (on 0.7):

(v0.7) pkg> ?pin
  pin pkg[=uuid] ...

  Pin packages to given versions, or the current version if no version is
  specified. A pinned package has its version fixed and will not be upgraded
  or downgraded. A pinned package has the symbol ⚲ next to its version in the
  status list.

(v0.7) pkg> 

So if you have Blink v0.6.2 and PlotlyJS v0.10.2 installed,

pin Blink
pin PlotlyJS

should be sufficient.

That makes sense. How can I resolve the uuid of v"0.6.2" of Blink and v"0.10.2" of PlotlyJS?

If you just want to pin the current version the uuid is not required.

That makes sense as well. But what if I want to pint to a specific, older version of the code?

The uuid refers to the package, not the version. If you want to pin a specific version, use add to obtain it, then pin to pin it.

(v0.7) pkg> add Blink
[...]

(v0.7) pkg> st
    Status `~/.julia/environments/v0.7/Project.toml`
  [ad839575] Blink v0.7.0

(v0.7) pkg> add Blink@0.6.2
 Resolving package versions...
  Updating `~/.julia/environments/v0.7/Project.toml`
  [ad839575] ↓ Blink v0.7.0 ⇒ v0.6.2
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [ad839575] ↓ Blink v0.7.0 ⇒ v0.6.2
[...]

(v0.7) pkg> st
    Status `~/.julia/environments/v0.7/Project.toml`
  [ad839575] Blink v0.6.2

(v0.7) pkg> pin Blink
 Resolving package versions...
  Updating `~/.julia/environments/v0.7/Project.toml`
  [ad839575] ~ Blink v0.6.2 ⇒ v0.6.2 ⚲
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [ad839575] ~ Blink v0.6.2 ⇒ v0.6.2 ⚲

(v0.7) pkg> st
    Status `~/.julia/environments/v0.7/Project.toml`
  [ad839575] Blink v0.6.2 ⚲
3 Likes

I tried this as I need package “GDAL” of version 0.1.2 pinned in Julia 0.7. But it does not work as expected.

(v0.7) pkg> add GDAL@0.1.2
Resolving package versions…
Updating ~/.Julia/environments/v0.7/Project.toml [add2ef01] + GDAL v0.2.0 updating ~/.Julia/environments/v0.7/Manifest.toml`

strange behavior?

You are posting the same question in multiple places. There is no need for that.

1 Like

oh. Thank you for letting me know. I will delete one if I get a solution.

No need to delete it now. The reason for this is to prevent people putting time into answering your question, when it might have already been answered elsewhere.

Short answer is you first have to add the package before pinning it, for full answer see: How to pin a package to a certain version using Julia 0.7? - Stack Overflow

2 Likes

What wrong in Pkg.pin(“DataFrames”,v"0.17.1") ?

julia> versioninfo()
Julia Version 0.7.0
Commit a4cb80f3ed (2018-08-08 06:46 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core™ i7-2630QM CPU @ 2.00GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.0 (ORCJIT, sandybridge)
julia> using Pkg

julia> Pkg.status()
Status C:\Users\progr\.julia\environments\v0.7\Project.toml
[a93c6f00] DataFrames v0.17.1 ⚲
[e7dc6d0d] DataValues v0.4.7
[89b67f3b] ExcelFiles v0.9.1
[c04bee98] ExcelReaders v0.11.0
[91a5bcdd] Plots v0.19.3
[d71aba96] ReadStat v0.4.1
[1463e38c] StatFiles v0.8.0
[c17dfb99] WinRPM v0.4.2
[bd07be1c] Winston v0.14.1
[fdbf4ff8] XLSX v0.4.7

julia> Pkg.pin(“DataFrames”,v"0.17.1")
ERROR: MethodError: no method matching pin(::String, ::VersionNumber)
Closest candidates are:
pin(::Union{String, PackageSpec}; kwargs…) at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v0.7\Pkg\src\API.jl:192
Stacktrace:
[1] top-level scope at none:0

Paul

Either pin DataFrames@0.17.1 in Pkg REPL mode or

using Pkg
Pkg.pin(PackageSpec(name="DataFrames", version="0.17.1"))
2 Likes