Base.Pkg is deprecated, but `using Pkg` errors out

Getting this with Julia v0.7 nightly on MacOS:

julia> Pkg.WARNING: Base.Pkg is deprecated, run `using Pkg` instead
 in module Main
julia> using Pkg
ERROR: importing Pkg into Main conflicts with an existing identifier

Checked thoroughly but I haven’t seen this reported yet, strangely. Thought I should check if it’s a known issue before opening a new one on Julia’s Github repo.

julia> versioninfo()
Julia Version 0.7.0-DEV.4480
Commit fa462ba112 (2018-03-07 11:38 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin14.5.0)
  CPU: Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-3.9.1 (ORCJIT, skylake)
Environment:
1 Like

Yeah, this is an awkward in-between state. The old names are still exported from Base to provide that re-direction and deprecation to the stdlib. If you do using Pkg then the stdlib names can gracefully layer on top and shadow the deprecations. Once you “touch” any of those bindings, though, then they’re unable to be shadowed anymore in your current session. I’m not aware of a workaround beyond restarting julia (or ignoring the deprecation message for the rest of that session).

Just put import Pkg into .julia/config/startup.jl.

4 Likes

Thank you. I’ve recently started testing out v0.7 but the changes are numerous and their impact quite far-reaching.

I’m in a special situation in that I have written 11 chapters of a beginner’s Julia book for the last 6 months, on v0.6.2. And I need to update the whole book to v0.7, for publishing, with the deadline at the end of the month. I’ve seen that some mainstream packages have been updated to support 0.7 but many still weren’t - most notably, so far, IJulia and Gadfly (which also holds back DataFrames, so it’s a special treat).

I really like the changes in 0.7 and where the whole ecosystem is heading, but in my particular case, these weeks are so frustrating.

2 Likes

In my humble opinion that deadline is not reasonable. 0.7 is not even out yet and as you have probably felt, a lot of the ecosystem has some catching up to do.

2 Likes

Yes, I completely agree - v0.7 looks great so far but it’s not production ready just yet (at least as much as a 0.x release can be production ready). Hopefully, it won’t be long.