# Using packages that were not added to the project's environment

**URL:** <https://discourse.julialang.org/t/using-packages-that-were-not-added-to-the-projects-environment/64159>\
**Category:** Package Management\
**Tags:** question, pkg, environment\
**Created:** [July 6, 2021, 4:40pm UTC](https://discourse.julialang.org/t/using-packages-that-were-not-added-to-the-projects-environment/64159 "2021-07-06T16:40:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuvalw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuvalw/32/19224_2.png) [@yuvalw](https://discourse.julialang.org/u/yuvalw)\
**Post date:** [July 6, 2021, 4:40pm UTC](https://discourse.julialang.org/t/using-packages-that-were-not-added-to-the-projects-environment/64159/1 "2021-07-06T16:40:15Z")

</div>

Hello,  
New user of Pkg. I’ve noticed that If I open a new directory and create a new environment, i.e. `] activate .`, I can run `using <SomePackage>` without `add`ing it, as long as `<SomePackage>` is in my general environment, and `Project.toml` remains unchanged. I’m pretty sure that at some point this will cause me to use packages without adding them and documenting them in `Project.toml`. Of course, a solution is having no packages in my general environment, but I feel that is inconvenient, and I prefer not having to create environments for small and quick stuff. Is there a reason it is so? Is there some other solution?  
Thanks

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [July 6, 2021, 5:05pm UTC](https://discourse.julialang.org/t/using-packages-that-were-not-added-to-the-projects-environment/64159/2 "2021-07-06T17:05:13Z")

</div>

I think you should `add` packages to the environment when they are dependencies of the current project, and only in that case. Otherwise just use `using` them. This is very typical, you have one package that depends on other packages, but to test it, for example, you need other packages that are not necessarily dependencies.

There is no need to create an environment for every little thing, just be careful when using `dev SomePackage` while in the general environment, _usually_ on the “main” environment one wants the stable versions of the packages.

---

<div class="post-metadata">

**Author:** ![yuvalw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuvalw/32/19224_2.png) [@yuvalw](https://discourse.julialang.org/u/yuvalw)\
**Post date:** [July 7, 2021, 2:30pm UTC](https://discourse.julialang.org/t/using-packages-that-were-not-added-to-the-projects-environment/64159/3 "2021-07-07T14:30:50Z")

</div>

Thanks, now it makes more sense why should you be able to use packages without adding them. However, I’m still a bit worried about forgetting to add packages which are dependencies to my project, since I can just use them without adding them and I won’t notice. I guess I should just be watchful for that.

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 7, 2021, 2:41pm UTC](https://discourse.julialang.org/t/using-packages-that-were-not-added-to-the-projects-environment/64159/4 "2021-07-07T14:41:05Z")

</div>

You can set `JULIA_LOAD_PATH` to `@` to only allow loading packages from the active project. You can configure this automatically on the project level using [direnv](https://direnv.net/). I wrote a post about that: [https://fredrikekre.se/posts/direnv-with-julia](https://fredrikekre.se/posts/direnv-with-julia/#package_environments).
