# Question about setting up new package environment

**URL:** <https://discourse.julialang.org/t/question-about-setting-up-new-package-environment/59571>\
**Category:** General Usage\
**Tags:** question, package, pkg\
**Created:** [April 18, 2021, 11:54pm UTC](https://discourse.julialang.org/t/question-about-setting-up-new-package-environment/59571 "2021-04-18T23:54:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![quazirfan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/quazirfan/32/23381_2.png) [@quazirfan](https://discourse.julialang.org/u/quazirfan)\
**Post date:** [April 18, 2021, 11:54pm UTC](https://discourse.julialang.org/t/question-about-setting-up-new-package-environment/59571/1 "2021-04-18T23:54:59Z")

</div>

I am trying to understand how I can efficiently setup a new package environment. I have the following questions,

1. When I create a new environment using `pkg> activate EnvName` - why the folder named EnvName with associated Manifest and Project toml files are not created right away? What do I need to do to have the folder automatically created and populated?

2. I am trying to understand the documentation about `--shared` switch of `pkg.activate` function. From the documentation, _When the option --shared is given, path will be assumed to be a directory name and searched for in the environments folders of the depots in the depot stack._

- Isn’t path is always a directory name? (I am assuming all pkg environment is a dedicated folder with some setting in toml file).
- What does it mean by ‘depots in the depot stack’?

Can anybody explain what `--shared` switch does some other way?

Thanks!

---

<div class="post-metadata">

**Author:** ![mmiller](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mmiller/32/20805_2.png) [@mmiller](https://discourse.julialang.org/u/mmiller)\
**Post date:** [April 19, 2021, 12:44am UTC](https://discourse.julialang.org/t/question-about-setting-up-new-package-environment/59571/2 "2021-04-19T00:44:42Z")

</div>

> 1. When I create a new environment using `pkg> activate EnvName` - why the folder named EnvName with associated Manifest and Project toml files are not created right away? What do I need to do to have the folder automatically created and populated?

I’m not sure why they are not created straight away, but they will be created when you add a package to the environment (`Pkg.add` or `Pkg.develop`). I’m guessing because there is no information to save until a package is actually added, nothing is created.

> 1. I am trying to understand the documentation about `--shared` switch of `pkg.activate` function. From the documentation, _When the option --shared is given, path will be assumed to be a directory name and searched for in the environments folders of the depots in the depot stack._

The `--shared` switch looks for/creates environments in a common location, regardless of the working folder. Unless you’ve changed the depot location, this will typically be at `~/.julia/enviroments`. You can change that location by modifying the depot location.

For example:

```Julia
(@v1.6) pkg> activate --shared MyEnv
  Activating new environment at `~/.julia/environments/MyEnv/Project.toml`
(@MyEnv) pkg> 

```

If I didn’t use the `--shared` flag, it would just make the environment in my current working folder. The `@` symbol infront of the environment name indicates that it’s a shared env.

> - Isn’t path is always a directory name? (I am assuming all pkg environment is a dedicated folder with some setting in toml file).

When not using a shared environment, path can actually be a directory, e.g.

```Julia
(MyEnv) pkg> activate MyFolder1/MyFolder2/MyEnv
  Activating new environment at `~/MyFolder1/MyFolder2/MyEnv/Project.toml`

```

This directory can be relative to current working directory, or absolute.

Note if I try to use a path with a shared environment it fails:

```Julia
(MyEnv) pkg> activate --shared MyFolder1/MyFolder2/MyEnv
ERROR: not a valid name for a shared environment: MyFolder1/MyFolder2/MyEnv

```

This is why the docs say “path will be assumed to be a directory name”.

> - What does it mean by ‘depots in the depot stack’?

The depot stack can be viewed by looking at the `DEPOT_PATH` variable in Julia. The depots in the depot stack are _where the package manager, as well as Julia’s code loading mechanisms, look for package registries, installed packages, named environments, repo clones, cached compiled package images, configuration files, and the default location of the REPL’s history file_ (from the [docs](https://docs.julialang.org/en/v1/manual/environment-variables/#JULIA_DEPOT_PATH))

For me (Mac user), `DEPOT_PATH` looks like:

```Julia
julia> DEPOT_PATH
3-element Vector{String}:
 "/Users/username/.julia"
 "/Applications/Julia-1.6.app/Contents/Resources/julia/local/share/julia"
 "/Applications/Julia-1.6.app/Contents/Resources/julia/share/julia"

```

It can be seen that the first depot in the path is where my shared environment was created above. If I wanted the depot to be elsewhere I could modify this variable by pushing in a new folder.
