Pkg.jl: Error calling `up`

Created on 1 Apr 2018  路  7Comments  路  Source: JuliaLang/Pkg.jl

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: https://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.7.0-DEV.4727 (2018-03-31 15:54 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit 025a9ee3ed (0 days old master)
|__/                   |  x86_64-cros-linux-gnu

pkg> up
  Updating registry at `~/.julia/registries/Uncurated`
 Resolving package versions...
ERROR: MethodError: Cannot `convert` an object of type Pkg3.Types.VersionSpec to an object of type VersionNumber
Closest candidates are:
  convert(::Type{VersionNumber}, ::Integer) at deprecated.jl:55
  convert(::Type{VersionNumber}, ::Tuple) at deprecated.jl:55
  convert(::Type{VersionNumber}, ::AbstractString) at deprecated.jl:55
  ...
Stacktrace:
 [1] Pkg3.Types.Fixed(::Pkg3.Types.VersionSpec, ::Dict{Base.UUID,Pkg3.Types.VersionSpec}) at /home/chronos/user/julia/usr/share/julia/site/v0.7/Pkg3/src/Types.jl:316
 [2] collect_fixed!(::Pkg3.Types.Context, ::Array{Pkg3.Types.PackageSpec,1}, ::Dict{Base.UUID,String}) at /home/chronos/user/julia/usr/share/julia/site/v0.7/Pkg3/src/Operations.jl:145
 [3] resolve_versions!(::Pkg3.Types.Context, ::Array{Pkg3.Types.PackageSpec,1}) at /home/chronos/user/julia/usr/share/julia/site/v0.7/Pkg3/src/Operations.jl:256
 [4] up(::Pkg3.Types.Context, ::Array{Pkg3.Types.PackageSpec,1}) at /home/chronos/user/julia/usr/share/julia/site/v0.7/Pkg3/src/Operations.jl:947

All 7 comments

I have the same issue. Looks like it's a problem in Operations.jl where the version field of the package is set to a VersionSpec here and then here we try to make a Fixed out of it, which has only one constructor:

Fixed(v::VersionNumber) = Fixed(v,Requires())

So we try to convert the VersionSpec to a VersionNumber which fails. Not sure how this should be resolved. Any ideas @KristofferC ?

I think this should be fixed on master so that the version field is always set before creating the Fixed. If you have a consistent way of reproducing I could test and see if it works now.

Ah yes, the old bug report without steps to reproduce ;)

In my case I can trigger by doing the following

  1. Create a package with a Project.toml that looks like this:
name = "AwesomePackage"
uuid = "..."
repo-url = "https://git-server/git-user/AwesomePackage.jl.git"
author = ["Git User <[email protected]>"]
  1. Install it via Pkg3
pkg> dev https://git-server/git-user/AwesomePackage.jl.git
  1. Call up
pkg> up

Thanks for the quick reply, let me know if you have any issues reproducing on your side.

Ok so I put up https://github.com/KristofferC/MyPackage and did:

(v0.7) pkg> dev https://github.com/KristofferC/MyPackage
   Cloning git-repo `https://github.com/KristofferC/MyPackage`
  Updating git-repo `https://github.com/KristofferC/MyPackage`
 Resolving package versions...
  Updating `~/.julia/environments/v0.7/Project.toml`
 [ca6b0568] + MyPackage v0.1.0 [`~/.julia/dev/MyPackage`]
  Updating `~/.julia/environments/v0.7/Manifest.toml`
 [ca6b0568] + MyPackage v0.1.0 [`~/.julia/dev/MyPackage`]

(v0.7) pkg> up
  Updating registry at `~/.julia/registries/Uncurated`
  Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
 Resolving package versions...
  Updating `~/.julia/environments/v0.7/Project.toml`
 [no changes]
  Updating `~/.julia/environments/v0.7/Manifest.toml`
 [no changes]

Seems fixed to me. I'll try update the Julia repo with new Pkg3 in not too long.

Can you reproduce the breakage by using the Pkg3 that comes with Julia?

Yep!

(v0.7) pkg> up
  Updating registry at `~/.julia/registries/Uncurated`
  Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
 Resolving package versions...
ERROR: MethodError: Cannot `convert` an object of type Pkg3.Types.VersionSpec to an object of type VersionNumber
Closest candidates are:
  convert(::Type{VersionNumber}, ::Integer) at deprecated.jl:55
  convert(::Type{VersionNumber}, ::Tuple) at deprecated.jl:55
  convert(::Type{VersionNumber}, ::AbstractString) at deprecated.jl:55
  ...
Stacktrace:
 [1] Pkg3.Types.Fixed(::Pkg3.Types.VersionSpec, ::Dict{Base.UUID,Pkg3.Types.VersionSpec}) at /Users/kristoffer/julia/usr/share/julia/site/v0.7/Pkg3/src/Types.jl:316
 [2] collect_fixed!(::Pkg3.Types.Context, ::Array{Pkg3.Types.PackageSpec,1}, ::Dict{Base.UUID,String}) at /Users/kristoffer/julia/usr/share/julia/site/v0.7/Pkg3/src/Operations.jl:145
 [3] resolve_versions!(::Pkg3.Types.Context, ::Array{Pkg3.Types.PackageSpec,1}) at /Users/kristoffer/julia/usr/share/julia/site/v0.7/Pkg3/src/Operations.jl:256

Will be fixed when #26768 is merged

Was this page helpful?
0 / 5 - 0 ratings