I am getting started with Julia. I have two questions.
wrt the directory: .julia/packages/*
- How do packages get created in said directory? What did I do to cause this?
- How (best practice) should they be removed/deleted?
Thanks so much
I am getting started with Julia. I have two questions.
wrt the directory: .julia/packages/*
Thanks so much
The source tree of a package version is put there when you install that version of the package, e.g. by doing ]
(to enter the Pkg REPL mode) and then do pkg> add Example
. You can delete them any time you want to, but of course, if some project was using a version then it won’t work anymore. It is easy to reinstall all the package versions that are used by a project by activating it (e.g. by starting Julia as julia --activate
in that project’s directory) and doing pkg> instantiate
. If you want to clean up versions of packages that are no longer used by any project, you can do pkg> gc
.
@StefanKarpinski: My understanding is that using “gc” simply clears the compiled version but not the pkgs in packages folder.
(v1.0) pkg> ?gc
Deletes packages that cannot be reached from any existing environment.
(v1.0) pkg> gc
Active manifests at:
`/home/pfitzseb/.julia/testenv/Manifest.toml`
`/home/pfitzseb/.julia/environments/v1.1/Manifest.toml`
`/home/pfitzseb/.julia/environments/v1.0/Manifest.toml`
`/home/pfitzseb/.julia/environments/v0.7/Manifest.toml`
Deleted /home/pfitzseb/.julia/packages/AbstractPlotting/ZHerD: 27.585 MiB
Deleted /home/pfitzseb/.julia/packages/Atom/WSz3k: 64.383 KiB
Deleted /home/pfitzseb/.julia/packages/Atom/jJn7Y: 62.389 KiB
...
@pfitzseb: thanks for clarification.
Thanks for the responses so far. Let me ask these two questions:
Why the error when I register my package? (See below)
How do I do a recompile? (Again, see below)
I am trying to get a development work flow going.
I create a project.
(v1.0) pkg> generate XYZ
I make it a git repository
cd XYZ
git init
I register it.
(v1.0) pkg> add /XYZ
I get an error ( see way below for full output ). Why the error?
I don’t see a package in .julia/packages. I do get an entry in .julia/environment/Manifest.toml
I going to be developing this package so I do…
(v1.0) pkg> dev /XYZ
I get an entry in .julia/compiled.
I use my package
julia> using XYZ
I run something.
julia> XYZ.go()
Ave Mundus!
Correct!
I make a change. I add an exclamation point
…
go() = print(“Ave Mundus!!”)
…
I try simply running again. I try pkg> update XYZ. I try pkg> build XYZ. No matter what, I still don’t get my added exclamation point. Clearly, I am missing something and I’ll bet it is embarrassingly simple. But what?
Thanks
The Output
Updating registry at ~/.julia/registries/General
Updating git-repo https://github.com/JuliaRegistries/General.git
Updating git-repo /Users/gcr/d4mWorkspace/XYZ
ERROR: GitError(Code:EUNBORNBRANCH, Class:Reference, reference ‘refs/heads/master’ not found)
#=
Why the above error?
=#
Stacktrace:
[1] head( ::LibGit2.GitRepo ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/LibGit2/src/error.jl:101
[2] branch( ::LibGit2.GitRepo ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/LibGit2/src/LibGit2.jl:368
[3] #handle_repos_add!#31( ::Bool, ::Nothing, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1} ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Types.jl:633
[4] #handle_repos_add! at ./none:0 [inlined]
[5] #add_or_develop#13( ::Symbol, ::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1} ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/API.jl:54
[6] (::getfield(Pkg.API, Symbol(“#kw##add_or_develop”)))( ::NamedTuple{(:mode,),Tuple{Symbol}}, ::typeof(Pkg.API.add_or_develop), ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1} ) at ./none:0
[7] do_add!( ::Dict{Symbol,Any}, ::Array{Pkg.Types.PackageSpec,1}, ::Dict{Symbol,Any} ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:633
[8] #invokelatest#1( ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Any, ::Any, ::Vararg{Any,N} where N ) at ./essentials.jl:686
[9] invokelatest( ::Any, ::Any, ::Vararg{Any,N} where N ) at ./essentials.jl:685
[10] do_cmd!( ::Pkg.REPLMode.PkgCommand, ::REPL.LineEditREPL ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:542
[11] #do_cmd#30( ::Bool, ::Function, ::REPL.LineEditREPL, ::String ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:507
[12] do_cmd at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:503 [inlined]
[13] (::getfield(Pkg.REPLMode, Symbol(“##41#44”)){REPL.LineEditREPL,REPL.LineEdit.Prompt})( ::REPL.LineEdit.MIState, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Bool ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/Pkg/src/REPLMode.jl:842
[14] #invokelatest#1 at ./essentials.jl:686 [inlined]
[15] invokelatest at ./essentials.jl:685 [inlined]
[16] run_interface( ::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/LineEdit.jl:2261
[17] run_frontend( ::REPL.LineEditREPL, ::REPL.REPLBackendRef ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:1029
[18] run_repl( ::REPL.AbstractREPL, ::Any ) at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/REPL.jl:191
[19] (::getfield(Base, Symbol(“##720#722”)){Bool,Bool,Bool,Bool})( ::Module ) at ./logging.jl:311
[20] #invokelatest#1 at ./essentials.jl:686 [inlined]
[21] invokelatest at ./essentials.jl:685 [inlined]
[22] macro expansion at ./logging.jl:308 [inlined]
[23] run_main_repl( ::Bool, ::Bool, ::Bool, ::Bool, ::Bool ) at ./client.jl:330
[24] exec_options( ::Base.JLOptions ) at ./client.jl:242
[25] _start() at ./client.jl:421
See PSA: how to quote code with backticks
A package is not automatically reloaded after you make changes. You probably want to look at Revise.jl, which does exactly this.
Ah, Revise does the trick. Thanks
I would still appreciate at if anyone can help me understand the aforementioned error.