ERROR: MethodError: no method matching pin(::String, ::VersionNumber)

I was using Julia 0.7 to install a package JEMSS.jl from this link:
During the process, I need to use the Julia 0.6 command
“ “GDAL”, v"0.1.2” )"
But when I tried it. I got an error like the following:
ERROR: MethodError: no method matching pin(::String, ::VersionNumber)
Can anyone point to me how to pin a package to a certain version in Julia 0.7?
Moreover, can I understand that Julia version 0.7 is an intermediate between 0.6 and 1.0? So if is it possible that I can combine code written in Julia 0.6 with package written in Julia 1.0 without too much efforts?

1 Like

You can just add the version explicitly (see the docs):

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

and if you really feel like it you can pin it afterwards:"GDAL")

Note that the new package manager does not update as aggressively, so the pin might be superfluous.

Just tried the command
Pkg.add(PackageSpec(name=“GDAL”, version=“0.1.2”)) and got an error saying that “PackageSpec” is not recognised. I guess it’s because I’m using Julia version 0.7. not version 1.0.

Did you using Pkg first?

Here are updates: I tried
using Pkg
Pkg.add(PackageSpec(name = “GDAL”, version = “0.1.2”))“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:

1 Like

this is really strange. I will post this as a new question to get more attention.

1 Like