Pkg.add behaves very strongly for Julia version 0.7

I’m using Julia version 0.7. and I’d like to add version 0.1.2 of the package “GDAL” and pin it. The following is the command I used.
‘using Pkg
Pkg.add(PackageSpec(name = “GDAL”, version = “0.1.2”))
Pkg.pin(“GDAL”)
Pkg.installed(“GDAL”)’

in the end, Pkg.installed(“GDAL”) still gives me v"0.2.0". It simply does not work in Julia 0.7. Or maybe I need to do this manually by my hand to delete the un-liked version and copy and paste the liked version. :wink:

The problem is
Pkg.pin(“GDAL”)

From help:

help?> Pkg.pin
  Pkg.pin(pkg::Union{String, Vector{String}})
  Pkg.pin(pkgs::Union{Packagespec, Vector{Packagespec}})


  Pin a package to the current version (or the one given in the packagespec or a certain git revision. A pinned package is never updated.

Try:

Pkg.pin(PackageSpec(name = "GDAL", version = "0.1.2"))

Hi, Simon, thank you for the quick reply. I tried and got the following error message.

Julia> Pkg.pin(PackageSpec(name = “GDAL”, version = “0.1.2”))

Error: the following package names could not be resolved: * GDAL(add… in manifest but not in project) Please specify by known ‘name=uuid’.

1 Like

If possible, I would try with 1.0.3. Pkg has gotten numerous bugfixes since 0.7.

1 Like

I’m puzzled as it works for me, both on Windows and Linux.
You may need someone who knows Pkg internals better than I do.

For reference, the exact sequence of steps that works for me and related output:

julia> using Pkg

julia> Pkg.add(PackageSpec(name = "GDAL", version = "0.1.2"))
  Updating registry at `C:\Users\simon\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
 Resolving package versions...
 Installed GDAL ─ v0.1.2
  Updating `C:\Users\simon\.julia\environments\v0.7\Project.toml`
  [add2ef01] + GDAL v0.1.2
  Updating `C:\Users\simon\.julia\environments\v0.7\Manifest.toml`
  [add2ef01] + GDAL v0.1.2
  Building GDAL → `C:\Users\simon\.julia\packages\GDAL\1n3nf\deps\build.log`

julia> Pkg.pin(PackageSpec(name = "GDAL", version = "0.1.2"))
 Resolving package versions...
  Updating `C:\Users\simon\.julia\environments\v0.7\Project.toml`
  [add2ef01] ~ GDAL v0.1.2 ⇒ v0.1.2 ⚲
  Updating `C:\Users\simon\.julia\environments\v0.7\Manifest.toml`
  [add2ef01] ~ GDAL v0.1.2 ⇒ v0.1.2 ⚲

julia> Pkg.installed()["GDAL"]
v"0.1.2"

I’m using Julia 0.7 on Linux. I will attach a picture of the screenshot soon.

after I remove several other “related” packages and tried again, it’s working this time.

julia> Pkg.installed()
Dict{String,Union{Nothing, VersionNumber}} with 5 entries:
“Juno” => v"0.5.3"
“OpenStreetMapX” => v"0.1.1"
“Plots” => v"0.19.3"
“Atom” => v"0.7.12"
“OpenStreetMapXPlot” => v"0.1.0"

julia> Pkg.add(PackageSpec(name = “GDAL”, version = “0.1.2”))
Resolving package versions…
Updating ~/.julia/environments/v0.7/Project.toml
[add2ef01] + GDAL v0.1.2
Updating ~/.julia/environments/v0.7/Manifest.toml
[add2ef01] + GDAL v0.1.2

julia> Pkg.pin(PackageSpec(name = “GDAL”, version = “0.1.2”))
Resolving package versions…
Updating ~/.julia/environments/v0.7/Project.toml
[add2ef01] ~ GDAL v0.1.2 ⇒ v0.1.2 ⚲
Updating ~/.julia/environments/v0.7/Manifest.toml
[add2ef01] ~ GDAL v0.1.2 ⇒ v0.1.2 ⚲

julia> Pkg.installed()
Dict{String,Union{Nothing, VersionNumber}} with 6 entries:
“Juno” => v"0.5.3"
“OpenStreetMapX” => v"0.1.1"
“GDAL” => v"0.1.2"
“Plots” => v"0.19.3"
“Atom” => v"0.7.12"
“OpenStreetMapXPlot” => v"0.1.0"