juliajulia-pkg

Cannot install any package in Julia


I had used Julia some months back for a project, and didn't use it since. I hadn't faced problems back then. But now, I absolutely am not able to install any package.

(@v1.5) pkg> add Distributions                                                                                           
  Resolving package versions...                                                                                         
 ERROR: Unsatisfiable requirements detected for package Distributions [31c24e10]:                                         
 Distributions [31c24e10] log:                                                                                           
 ├─Distributions [31c24e10] has no known versions!                                                                       
 └─restricted to versions * by an explicit requirement — no versions left

Any package I install, I am getting the same error. How do I fix it?

This is the status of Pkg:

(@v1.5) pkg> status                                                                                                     
Status `C:\Users\jaine\.julia\environments\v1.5\Project.toml`                                                             
[6e4b80f9] BenchmarkTools v0.5.0                                                                                        
[7073ff75] IJulia v1.21.2                                                                                               
[91a5bcdd] Plots v1.6.0                                                                                                 
[438e738f] PyCall v1.91.4                                                                                               
[d330b81b] PyPlot v2.9.0                                                                                                
[2913bbd2] StatsBase v0.33.0 

Solution

  • Given

    ├─Distributions [31c24e10] has no known versions!

    it looks like you have a missing or corrupt package registry. The package manager will reinstall it for you if you delete .julia/registries and try to add the package again. You can do this from within julia

    rm(joinpath(homedir(), ".julia", "registries"), recursive=true, force=true)