How do I know which enviroment I am in?

You can use Base.active_project(). It will return the address of the Project.toml used for the Pkg. Another similar method exist, Base.currect_project(), but the “current” there refers to the first Project.toml you find searching up from your current location pwd(), not the one used by the Pkg.
They can match or not.

Example: Opening a julia section in my home directory.

julia> # Press ]
(@v1.5) pkg> # At first, my global envitoment is activated
julia> Base.current_project()
# Returns nothing (or empty string, I don't know)
# This is because in my home folder (and parents), no Project.toml exist.
julia> Base.active_project()
"/Users/Pereiro/.julia/environments/v1.5/Project.toml"
# This time, the active global Project.toml is returned
julia> cd("/Users/Pereiro/.julia/environments/v1.5")
# If I navigate to its container folder now both methods returns the same
julia> Base.current_project() == Base.active_project()
true
2 Likes