# Inherit transitive dependency resolution from parent environments

**URL:** https://discourse.julialang.org/t/inherit-transitive-dependency-resolution-from-parent-environments/79233
**Category:** Package Management
**Tags:** question, package, pkg
**Created:** [April 8, 2022, 4:49pm UTC](https://discourse.julialang.org/t/inherit-transitive-dependency-resolution-from-parent-environments/79233 "2022-04-08T16:49:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![thazhemadam](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@thazhemadam](https://discourse.julialang.org/u/thazhemadam)
#### Post date: [April 8, 2022, 4:49pm UTC](https://discourse.julialang.org/t/inherit-transitive-dependency-resolution-from-parent-environments/79233/1 "2022-04-08T16:49:32Z")

</div>

Assume I have an environment with packages X and Y, where X and Y both depend on a common package Z.  
If I `] add X`, I would get `v0.2.0` of package Z.  
If I `] add X, Y`, Pkg resolves Y’s compat restrictions on Z, and I get `v0.1.0` of package Z. Let’s call the environment that has both X and Y in it the “parent environment”.

Now, I want to `] add X` while being wary of Y’s compat restriction without actually adding Y, i.e., when I do `] add X` , I want Z to automatically resolve to `v0.1.0` instead of `v0.2.0` .

Is there any way I can do this?

I also have access to the parent environment (both, `Project.toml` and `Manifest.toml` are accessible), so is there some way I can inherit the transitive dependency resolution followed in the original environment in a new environment where I want to add only X and have Z set to `v0.1.0` instead?

Can I use the `Pkg.Types.EnvCache()` (or something else from Pkg internals) of the parent environment in some way, to achieve this?

---

<div class="post-metadata">

### Author: ![thazhemadam](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@thazhemadam](https://discourse.julialang.org/u/thazhemadam)
#### Post date: [April 8, 2022, 4:54pm UTC](https://discourse.julialang.org/t/inherit-transitive-dependency-resolution-from-parent-environments/79233/2 "2022-04-08T16:54:23Z")

</div>

Basically what I want to do is tell Pkg -

> “Here, take this `EnvCache` (or whatever other Pkg internal is better suited for this), see how/to what version you’ve resolved this dependency before, and do the same again.”

---

<div class="post-metadata">

### Author: ![thazhemadam](https://avatars.discourse-cdn.com/v4/letter/t/ad7895/32.png) [@thazhemadam](https://discourse.julialang.org/u/thazhemadam)
#### Post date: [April 8, 2022, 5:05pm UTC](https://discourse.julialang.org/t/inherit-transitive-dependency-resolution-from-parent-environments/79233/3 "2022-04-08T17:05:14Z")

</div>

So far, manually parsing the `Manifest.toml`, figuring out the dependencies and adding `Z@0.1.0` seems to be the only immediate solution.  
I would however love to know if there are any alternative solutions and/or if Pkg itself supports this in some way.
