Package installation error, wrong path?

I think I have set up my julia environemnt in a crappy way. When I tried to load a package there was an error that struck me as a path error.

(@v1.5) pkg> add HypothesisTests
 Installing known registries into `C:\Users\angus\.julia`
ERROR: SystemError: opening file "C:\\Users\\angus\\.julia\\registries\\General\\Registry.toml": No such file or directory
 [1] systemerror(::String, ::Int32; extrainfo::Nothing) at .\error.jl:168
 [2] #systemerror#48 at .\error.jl:167 [inlined]
 [3] systemerror at .\error.jl:167 [inlined]
 [4] open(::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Nothing, append::Nothing) at .\iostream.jl:284       
 [5] open at .\iostream.jl:273 [inlined]
 [6] open(::Base.var"#294#295"{Tuple{}}, ::String; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at .\io.jl:323
 [7] open at .\io.jl:323 [inlined]
 [8] read at .\io.jl:408 [inlined]
 [9] parsefile at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\ext\TOML\src\TOML.jl:50 [inlined]
 [10] read_registry(::String; cache::Bool) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:1044
 [11] read_registry at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:1039 [inlined]
 [12] (::Pkg.Types.var"#94#97"{Pkg.Types.Context,String,Pkg.Types.RegistrySpec})(::String) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:1016
 [13] mktempdir(::Pkg.Types.var"#94#97"{Pkg.Types.Context,String,Pkg.Types.RegistrySpec}, ::String; prefix::String) at .\file.jl:709
 [14] mktempdir at .\file.jl:707 [inlined] (repeats 2 times)
 [15] clone_or_cp_registries(::Pkg.Types.Context, ::Array{Pkg.Types.RegistrySpec,1}, ::String) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:980
 [16] clone_or_cp_registries at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:973 [inlined]
 [17] clone_default_registries(::Pkg.Types.Context; only_if_empty::Bool) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:874
 [18] clone_default_registries at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:862 [inlined]
 [19] find_registered!(::Pkg.Types.Context, ::Array{String,1}, ::Array{Base.UUID,1}) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:1239
 [20] registry_resolve!(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\Types.jl:770
 [21] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}; preserve::Pkg.Types.PreserveLevel, platform::Pkg.BinaryPlatforms.Windows, kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:175
 [22] add(::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:139
 [23] #add#21 at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67 [inlined]
 [24] add(::Array{Pkg.Types.PackageSpec,1}) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\API.jl:67
 [25] do_cmd!(::Pkg.REPLMode.Command, ::REPL.LineEditREPL) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:404
 [26] do_cmd(::REPL.LineEditREPL, ::String; do_rethrow::Bool) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:382
 [27] do_cmd at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:377 [inlined]
 [28] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL,REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\Pkg\src\REPLMode\REPLMode.jl:546
 [29] #invokelatest#1 at .\essentials.jl:710 [inlined]
 [30] invokelatest at .\essentials.jl:709 [inlined]
 [31] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\REPL\src\LineEdit.jl:2355
 [32] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at C:\buildbot\worker\package_win32\build\usr\share\julia\stdlib\v1.5\REPL\src\REPL.jl:1144
 [33] (::REPL.var"#38#42"{REPL.LineEditREPL,REPL.REPLBackendRef})() at .\task.jl:356

Not sure what to run to determine where my julia repository is located. Also I feel like I should be making a specific environment for this project and I’m unsure how to do that. Is there anything like conda for julia?

What exactly have you done?

Check if C:\Users\angus\.julia already exists and if you can write and change files inside. Perhaps you just lost the rights to this folder.
If it exists, juts try to rename the folder .julia to e.g. .juliaXXX and try again to add HypothesisTests from a newly started REPL.
If this works you can remove the newly created folder .julia and rename back .juliaXXX to .julia. Give full access to this folder and recursively to all its content to user angus (I hope you know how to to that). This should solve your issue.

It should also be save to just delete the folder C:\\Users\\angus\\.julia\\registries\\General. It should be regenerated in the next new REPL if you do add something.

1 Like

.julia does exist.

I have tried deleting C:\\Users\\angus\\.julia\\registries\\General

The add packages gets hung at

Installing known registries into 'C:\Users\angus\.julia' its currently stuck there for the past 15 minutes but its running now. Tha package successfully installed and I loaded it as well. Though Julia is generally being slow about this process. In python or R packages load nearly instantly most of the time so I am surprised to see julia get so hung up about installing and loading.

I do not know how to give full access to a folder, please explain that. I know it’s not a problem for me now but it seems like something I should know how to do.

It looks like you are using Julia version 1.5, where this is a known issue for some combination of Windows/antivirus/filesystem settings. This has been greatly improved in more recent Julia versions.

I suggest that you

  1. delete the folder .julia/registries,
  2. install Julia version 1.8.0 from Download Julia,
  3. retry.

Why can’t I just run update julia?

I just found this stack post that may be of interest: How to upgrade Julia to a new release? - Stack Overflow

Just do as @fredrikekre says. Downloading and installing current version is a no-brainer. Much easier than anything you may mean by “run update julia”. I missed that you are on 1.5. You don’t want to be on 1.5!

I disagree take a look at the stack post this package is currently running on my PC and works fine. I am enjoying julia but it needs to be a smoother experience. People shouldn’t have to go mucking about in the file directory for basic things like updating. I should not be manually reinstalling every time there’s a update. This UpdateJulia package should be the default solution or ideally just incorporated into the main julia release from now on.

I agree that you may have a bad experience now and you would wish for something smoother, but I can only help you so far as the current possibilities are available and of course, there is always something I or others don’t know.

On windows, as far as I know, the smoothest way of installing and maintaining julia is currently juliaup. So, I won’t recommend this now to you, because it derails your original problem. But of course you decide. You can go this path of juliaup by just installing Julia from the Microsoft Store (just search for Julia or this link: Microsoft Apps ). There is more information about it here: GitHub - JuliaLang/juliaup: Julia installer and version multiplexer

There are now two open options for you to go. Let us know, what you have decided and if it solves your issue.

The path of package UpdateJulia seems to be a problem as you have a problem using/adding packages (and I have no experience with it).

I appreciate the help but I think you should look at that julia package in the slack post, you can install it yourself using add UpdateJulia then just run Using Update Julia followed by update_julia().

It will automatically start updating packages in your general julia environment as well and if it can’t it spits out a report telling you where it could and couldn’t do this. Its working fine.

I don’t have any problem, so I will not do that. But perhaps, are you telling me, that you have done it already and you are fine now?

Yes exactly and I am encouraging you to provide this as a solution to others in the future. They may find it easier since this package will also manage the updating of all the other packages and is much closer solution to what is done in other languages. New users will appreciate this.

Deleting the julia instillation and reinstalling should be a secondary solution, sometimes I have to do that in R or Python if I’ve really gunked something up but it is definitely not preferred. I am just sharing my experience with this.

I can’t provide this solution for problems where add SomePackage gives an error.
But I am happy that it worked for you.