Load pkg in startup, then activate environment

What happens if a launch julia, load a package, and then activate a new enviroment?

The short answer is nothing.

The longer answer is that you can get yourself in trouble when loading packages from different environments in the same session as you can circumvent compat and get incompatible versions running, e.g.:

(@TestOldEnv) pkg> add DataFrames@1.0
   Resolving package versions...
   Installed DataFrames ─ v1.0.2
    Updating `C:\Users\ngudat\.julia\environments\TestOldEnv\Project.toml`
⌃ [a93c6f00] ↓ DataFrames v1.5.0 ⇒ v1.0.2
⌅ [08abe8d2] ↓ PrettyTables v2.2.4 ⇒ v1.3.1

here’s an old DataFrames version which uses PrettyTables v1, if I wanted to use PrettyTables v2 in the same environment that wouldn’t work:

(@TestOldEnv) pkg> add DataFrames@1.0 PrettyTables@2
   Resolving package versions...
ERROR: Unsatisfiable requirements detected for package PrettyTables [08abe8d2]

but I can do:

In [17]: using DataFrames

(@TestOldEnv) pkg> activate @TestNewEnv
  Activating new project at `C:\Users\ngudat\.julia\environments\TestNewEnv`

(@TestNewEnv) pkg> add PrettyTables@2
   Resolving package versions...
    Updating `C:\Users\ngudat\.julia\environments\TestNewEnv\Project.toml`
  [08abe8d2] + PrettyTables v2.2.4

In [20]: using PrettyTables
1 Like