# \[Pkg3\] Is there any way to install packages "globally"

**URL:** <https://discourse.julialang.org/t/pkg3-is-there-any-way-to-install-packages-globally/10687>\
**Category:** General Usage\
**Tags:** package, pkg, package-manager\
**Created:** [May 3, 2018, 2:45pm UTC](https://discourse.julialang.org/t/pkg3-is-there-any-way-to-install-packages-globally/10687 "2018-05-03T14:45:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Iagoba\_Apellaniz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/iagoba_apellaniz/32/34406_2.png) [@Iagoba\_Apellaniz](https://discourse.julialang.org/u/Iagoba_Apellaniz)\
**Post date:** [May 3, 2018, 2:45pm UTC](https://discourse.julialang.org/t/pkg3-is-there-any-way-to-install-packages-globally/10687/1 "2018-05-03T14:45:07Z")

</div>

I’m not sure how to install some package and make it available globally. I mean, that I understand that inside some folder with some `project.tolm` only packages registered on that file should be available (in principle. This also could be different, using some mechanism so I could allow somehow some script or the REPL to use globally installed packages). My question is that when I add some package to v0.7 I was thinking that I could use it anywhere. But that doesn’t seem to be the case

```julia
(v0.7) pkg> st
Status `~/.julia/environments/v0.7/Project.toml`
 [6e4b80f9] BenchmarkTools v0.3.0
 [7073ff75] IJulia v1.8.0
 [91a5bcdd] Plots v0.17.0

julia> using Plots
ERROR: ArgumentError: Module Pkg not found in current path.
Run `Pkg.add("Pkg")` to install the Pkg package.
...

```

UPDATE: It seems that the problem is related more with `JULIA_LOAD_PATH`

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [May 3, 2018, 3:23pm UTC](https://discourse.julialang.org/t/pkg3-is-there-any-way-to-install-packages-globally/10687/2 "2018-05-03T15:23:03Z")

</div>

That error message is a bit of a catch-22 by the way 🙂

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [May 3, 2018, 8:50pm UTC](https://discourse.julialang.org/t/pkg3-is-there-any-way-to-install-packages-globally/10687/3 "2018-05-03T20:50:42Z")

</div>

The error message are still from the Pkg2 era where everything that somehow managed to be find through all of the loadpaths are loadable in any package. We need to update it.

The reason for this specific error is the following:

- Packages in a Pkg3 world need to declare their dependencies (including stdlibs).
- To try make old packages (without Project files) work in the Pkg3 world we parse them and look for import statements that import stdlibs and add that to their registry dependencies.
- Pkg is special in the sense that this module existed and was exported in 0.6, there is thus no need to import it. We thus fail to find that Plots uses Pkg and thus not add it to the registry.

A short term fix would probably be to add `import Pkg` to Plots.jl and register a new version of the package. I could also just make the registry script add Pkg to the dependencies for Plots.

---

<div class="post-metadata">

**Author:** ![piever](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/piever/32/1815_2.png) [@piever](https://discourse.julialang.org/u/piever)\
**Post date:** [May 4, 2018, 9:33am UTC](https://discourse.julialang.org/t/pkg3-is-there-any-way-to-install-packages-globally/10687/4 "2018-05-04T09:33:21Z")

</div>

In any case, I don’t think Plots has been updated to work on Julia 0.7, but we can certainly add a `import Pkg` statement when updating the package to Julia master.
