Errors when trying the new package manager (0.7)

I’m trying out the new package manager, but get stuck following the docs here: https://docs.julialang.org/en/latest/stdlib/Pkg.html#Adding-packages-to-the-project-1

julia> import HelloWorld

julia> HelloWorld.greet()
Hello World!
julia> 

(HelloWorld) pkg> add Random
 Resolving package versions...
  Updating `../Project.toml`
  [9a3f8284] + Random 
  Updating `../Manifest.toml`
  [9a3f8284] + Random 

(HelloWorld) pkg> add JSON
ERROR: The following package names could not be resolved:
 * JSON (not found in project, manifest or registry)
Please specify by known `name=uuid`.

Similarly on the next step:

(HelloWorld) pkg> add https://github.com/fredrikekre/ImportMacros.jl                                                                                                     
  Updating git-repo `https://github.com/fredrikekre/ImportMacros.jl`                                                                                                     
┌ Warning: packages will require to have a [Julia]Project.toml file in the future                                                                                        
└ @ Pkg.Types Types.jl:814                                                                                                                                               
[ Info: Assigning UUID 145ac618-5f2d-11e8-1b45-c5aa9d0e379a to ImportMacros                                                                                              
 Resolving package versions...                                                                                                                                           
ERROR: The following package names could not be resolved:                                                                                                                
 * MacroTools (not found in project, manifest or registry)
Please specify by known `name=uuid`.

Also the same thing happens when trying to install a package “normally”, i.e. not inside a “project”.

Something seems strange with your registry. Can you try to remove .julia/registries and try again.

This is what I get:

(v0.7) pkg> add https://github.com/fredrikekre/ImportMacros.jl
  Updating git-repo `https://github.com/fredrikekre/ImportMacros.jl`
┌ Warning: packages will require to have a [Julia]Project.toml file in the future
└ @ Pkg.Types Types.jl:814
[ Info: Assigning UUID 7c456fe6-5f30-11e8-3ace-f50c1f4cee28 to ImportMacros
  Updating registry at `~/.julia/registries/Uncurated`
  Updating git-repo `https://github.com/JuliaRegistries/Uncurated.git`
 Resolving package versions...
Downloaded MacroTools ─ v0.4.0
  Updating `~/.julia/environments/v0.7/Project.toml`
  [7c456fe6] + ImportMacros v0.0.0 # [https://github.com/fredrikekre/ImportMacros.jl]
  Updating `~/.julia/environments/v0.7/Manifest.toml`
  [7c456fe6] + ImportMacros v0.0.0 # [https://github.com/fredrikekre/ImportMacros.jl]
  [1914dd2f] + MacroTools v0.4.0
2 Likes

Yes, I think that was it. After doing a git pull in .julia/registries/Uncurated it now seems to work. I suspect I had a few month old version of the registries.

I have another one now:

(v0.7) pkg> status                                                                                                                                                       
    Status `~/.julia/environments/v0.7/Project.toml`                                                                                                                     
  [295af30f] Revise v0.3.0+ [`~/.julia/dev/Revise`]                                                                                                                      
                                                                                                                                                                         
(v0.7) pkg> precompile                                                                                                                                                   
Precompiling project...                                                                                                                                                  
Precompiling Revise [1 of 1]                                                                                                                                             
ERROR: UndefVarError: OldPkg not defined                                                                                                                                 

and when I just try to use it:

julia> using Revise                                                                                                                                                                                                                           
[ Info: Precompiling module Revise                                                                                                                                                                                                            
ERROR: LoadError: ArgumentError: Module Pkg not found in current path.                                                                                                                                                                        
Run `Pkg.add("Pkg")` to install the Pkg package.                                                                                                                                                                                              
Stacktrace:                                                                                                                                                                                                                                   
 [1] _require(::Base.PkgId) at ./loading.jl:949                                                                                                                                                                                               
 [2] require(::Base.PkgId) at ./loading.jl:877                                                                                                                                                                                                
...
1 Like

Loading Revise should work now. A new Compat had to be tagged and propagated to the registry.

I’ll look into the precompile problem.

1 Like

Ok, now with Compat at 0.65.1 the using ... works, but yes the precompile still errors. Thanks!

https://github.com/JuliaLang/julia/pull/27246

1 Like

That PR works for me, thanks!

Thanks for this, just fixed an issue for me after I had removed and reinstalled Julia 1.0.1.