# Pkg instantiate a package

**URL:** <https://discourse.julialang.org/t/pkg-instantiate-a-package/33396>\
**Category:** General Usage\
**Tags:** question\
**Created:** [January 15, 2020, 1:23pm UTC](https://discourse.julialang.org/t/pkg-instantiate-a-package/33396 "2020-01-15T13:23:08Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Post date:** [January 15, 2020, 1:23pm UTC](https://discourse.julialang.org/t/pkg-instantiate-a-package/33396/1 "2020-01-15T13:23:08Z")

</div>

Hi,

I currently develop interdependent Julia packages and look for an easy way to share my work to others. The packages are all un-registered yet.

What I understood so far to realize this:

- define dependencies by reference to git repositories
- so that the manifest file contains all info
- then use Pkg instantiate to instantiate the package

What I was expecting to work, but didn’t work, is the following

```julia
] instantiate https://www.github.com/my/toplevel/package/linking/all/others

```

and it would download the package, install its dependencies, adding all dependencies to the current project, and lastly adding the toplevel package itself to the current project.

I.e. I thought instead of `add` I can just call `instantiate` and deal with all these dependencies which are not yet in a registry. Does not work unfortunately

Any help is highly appreciated.

---

<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:** [January 15, 2020, 1:37pm UTC](https://discourse.julialang.org/t/pkg-instantiate-a-package/33396/2 "2020-01-15T13:37:36Z")

</div>

You will have to get the `Project.toml` and `Manifest.toml` files first, e.g. by `git clone`ing:

```nohighlight
$ git clone https://www.github.com/my/toplevel/package/linking/all/others tmp

$ cd tmp

$ jlpkg --project instantiate # or julia --project -e 'using Pkg; Pkg.instantiate()'

```

---

<div class="post-metadata">

**Author:** ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Post date:** [January 15, 2020, 2:23pm UTC](https://discourse.julialang.org/t/pkg-instantiate-a-package/33396/3 "2020-01-15T14:23:18Z")

</div>

good to know that it is working for a checkout repository, however my use-case is differently:

- I just want to share my state with others
- they not necessarily want to dev further

hence I really rather look for a flexible alternative for `] add` in order to add dependencies with non-registered packages

my gut-feeling tells me there is none right now and you better define your custom registry…

---

<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:** [January 15, 2020, 2:59pm UTC](https://discourse.julialang.org/t/pkg-instantiate-a-package/33396/4 "2020-01-15T14:59:20Z")

</div>

You can share the `Project.toml` + `Manifest.toml` files then.

---

<div class="post-metadata">

**Author:** ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Post date:** [January 15, 2020, 3:02pm UTC](https://discourse.julialang.org/t/pkg-instantiate-a-package/33396/5 "2020-01-15T15:02:01Z")

</div>

can you explain in more detail what the steps would be?

(I just read up more and more about the registry approach and it really looks not mature right now - e.g. [here is a recommendation against](https://stackoverflow.com/questions/57965361/how-to-register-a-local-julia-package-in-a-local-registry) using registries when possible)

---

<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:** [January 15, 2020, 3:07pm UTC](https://discourse.julialang.org/t/pkg-instantiate-a-package/33396/6 "2020-01-15T15:07:24Z")

</div>

> [@schlichtanders](#):
>
> can you explain in more detail what the steps would be?

Just publish the environment you want the users to replicate somewhere where they can download them and then instantiate. Pseudo-code:

```julia
$ mkdir my-env
$ curl -o my-env/Project.toml url.to.project/Project.toml
$ curl -o my-env/Manifest.toml url.to.project/Manifest.toml
$ julia --project=my-env -e 'using Pkg; Pkg.instantiate()'

```
