# Meaning of \`pkgdir\`

**URL:** <https://discourse.julialang.org/t/meaning-of-pkgdir/64563>\
**Category:** General Usage\
**Tags:** question\
**Created:** [July 13, 2021, 12:33pm UTC](https://discourse.julialang.org/t/meaning-of-pkgdir/64563 "2021-07-13T12:33:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ThomasBreuer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thomasbreuer/32/27086_2.png) [@ThomasBreuer](https://discourse.julialang.org/u/ThomasBreuer)\
**Post date:** [July 13, 2021, 12:33pm UTC](https://discourse.julialang.org/t/meaning-of-pkgdir/64563/1 "2021-07-13T12:33:15Z")

</div>

Calling `Pkg.activate` (in Julia 1.5.3) seems to change the output of `pkgdir`.  
My situation is as follows.

Two versions of a package `X`, say, are installed, a released one in `~/.julia/packages` and a develop version in another place.  
I load the latter version into my Julia session, and `pkgdir(X)` shows its path. Fine.

Now I call `Pkg.activate` with some directory path.

Afterwards, the result of `pkgdir(X)` depends on whether or not the activated directory contains a file `Project.toml`:  
If not then `pkgdir(X)` returns the same as before.  
But if yes then the path in `~/.julia/packages` is returned.

Is this behaviour intended?  
If yes then what is the recommended way to find the location of a loaded package?

---

<div class="post-metadata">

**Author:** ![rashid](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rashid/32/9398_2.png) [@rashid](https://discourse.julialang.org/u/rashid)\
**Post date:** [July 14, 2021, 11:56am UTC](https://discourse.julialang.org/t/meaning-of-pkgdir/64563/2 "2021-07-14T11:56:49Z")

</div>

> [@ThomasBreuer](#):
>
> Afterwards, the result of `pkgdir(X)` depends on whether or not the activated directory contains a file `Project.toml`

I don’t see this. In both cases `pkgdir(X)` returns the directory where the develop version is located. Which is expected, as I have loaded the develop version and activating another environment after loading a package won’t change the pkgdir as the curretly loaded version is still the develop version I loaded first. To use the version in the newly activated environment you will have to restart the REPL. Can you give an MWE for what you observe.
