I don’t know why but I am having a terrible time understanding environments in Julia. I really want to understand what activate
does and how one should use it. Here is just one of the things I am not wrapping my head around.
In my v1.2
environment, I am able to add
and using
the Bootstrap
package. That is,
julia> using Bootstrap
[ Info: Precompiling Bootstrap [e28b5b4c-05e8-5b66-bc03-6f0c0a0a06e0]
julia>
If I exit and restart Julia, and switch my environment to a project I am working on (in .julia/dev/
), it dosn’t compile.
(v1.2) pkg> activate thvaccine
Activating environment at `~/.julia/dev/thvaccine/Project.toml`
(thvaccine) pkg>
julia> using Bootstrap
[ Info: Recompiling stale cache file /home/affans/.julia/compiled/v1.2/Bootstrap/0NS1M.ji for Bootstrap [e28b5b4c-05e8-5b66-bc03-6f0c0a0a06e0]
ERROR: LoadError: UndefVarError: levels not defined
Stacktrace:
[1] include at ./boot.jl:328 [inlined]
[2] include_relative(::Module, ::String) at ./loading.jl:1094
[3] include(::Module, ::String) at ./Base.jl:31
[4] top-level scope at none:2
[5] eval at ./boot.jl:330 [inlined]
[6] eval(::Expr) at ./client.jl:432
[7] top-level scope at ./none:3
in expression starting at /home/affans/.julia/packages/StatsModels/9cHwk/src/StatsModels.jl:7
ERROR: LoadError: Failed to precompile StatsModels [3eaba693-59b7-5ba5-a881-562e759f1c8d] to /home/affans/.julia/compiled/v1.2/StatsModels/4MFnV.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1253
[3] _require(::Base.PkgId) at ./loading.jl:1013
[4] require(::Base.PkgId) at ./loading.jl:911
[5] require(::Module, ::Symbol) at ./loading.jl:906
[6] include at ./boot.jl:328 [inlined]
[7] include_relative(::Module, ::String) at ./loading.jl:1094
[8] include(::Module, ::String) at ./Base.jl:31
[9] top-level scope at none:2
[10] eval at ./boot.jl:330 [inlined]
[11] eval(::Expr) at ./client.jl:432
[12] top-level scope at ./none:3
in expression starting at /home/affans/.julia/packages/Bootstrap/QldPq/src/Bootstrap.jl:13
ERROR: Failed to precompile Bootstrap [e28b5b4c-05e8-5b66-bc03-6f0c0a0a06e0] to /home/affans/.julia/compiled/v1.2/Bootstrap/0NS1M.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1253
[3] _require(::Base.PkgId) at ./loading.jl:1013
[4] require(::Base.PkgId) at ./loading.jl:911
[5] require(::Module, ::Symbol) at ./loading.jl:906
I am assuming this has something to do with my Project.toml
files, and something with the wrong versions of StatsModel
. My project dosn’t really depend on Bootstrap
so I don’t want to add it to the project’s Project.toml
file. I do want the package installed in my global environment for data analysis. I do want to be able to say using Bootstrap
even when I am in my project’s environment. As far as I remember, using
should pull the package from my v1.2
environment.
Is there a summary/blog post of how environments/activate
really work?