# Developing packages that are already in the loaded sysimage

**URL:** <https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950>\
**Category:** General Usage\
**Tags:** package, sysimage\
**Created:** [March 16, 2022, 6:13am UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950 "2022-03-16T06:13:09Z")\
**Posts on this page:** 7\
**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:** [March 16, 2022, 6:13am UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950/1 "2022-03-16T06:13:09Z")

</div>

How can I develop a package, `MyPkg`, when a sysimage that contains `MyPkg` (among others) is already loaded?  
So far, the only thing that’s worked for me is locally changing the UUID and name of the development version of the package entirely. There’s gotta be an easier way to do this (maybe some `Revise`-wizardry?)

---

<div class="post-metadata">

**Author:** ![lawless-m](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lawless-m/32/30869_2.png) [@lawless-m](https://discourse.julialang.org/u/lawless-m)\
**Post date:** [March 16, 2022, 8:40am UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950/2 "2022-03-16T08:40:48Z")

</div>

EDIT: Oh, I misunderstood the question. I’ll leave this here anyway

```julia
using Pkg
using PackageCompiler
Pkg.activate("/path/to/MyPkg")
create_sysimage(; sysimage_path="MyPkg.so")

```

and then when you want to use it

```julia
$ julia --sysimage /path/to/MyPkg.so
```

---

<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:** [March 16, 2022, 8:46am UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950/3 "2022-03-16T08:46:42Z")

</div>

> [@thazhemadam](#):
>
> So far, the only thing that’s worked for me is locally changing the UUID and name of the development version of the package entirely.

Updating the UUID is enough, the name can stay the same.

> [@thazhemadam](#):
>
> There’s gotta be an easier way to do this (maybe some `Revise` -wizardry?)

If you update the UUID it should “just work” with Revise, no wizardry needed.

---

<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:** [March 17, 2022, 6:40am UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950/4 "2022-03-17T06:40:31Z")

</div>

> Updating the UUID is enough, the name can stay the same.

That doesn’t seem to work for me, for whatever reason, on Julia `1.6.5`.

Here’s the error I get when I update the UUID and try to load the module with the sysimage loaded (with `JSON3` as `MyPkg`) -

```julia
julia> using JSON3
WARNING: using JSON3.JSON3 in module Main conflicts with an existing identifier.
ERROR: importing JSON3 into Main conflicts with an existing identifier

```

---

<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:** [March 17, 2022, 9:11am UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950/5 "2022-03-17T09:11:13Z")

</div>

I think you have to describe more what you are actually doing then. `JSON3` is not in the (default) sysimage, so you shouldn’t have to do any UUID-trickery at all.

---

<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:** [March 17, 2022, 11:38am UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950/6 "2022-03-17T11:38:57Z")

</div>

Let me elaborate.  
I’m creating a custom sysimage, that has a few packages, which includes `JSON3`.

```julia
julia> create_sysimage(["JSON3", ...]; sysimage_path = "sysimage_test.so")

```

Now, I also want to actively develop a local copy of `JSON3` and run the tests with the latest changes that I have, while having this custom sysimage loaded  
`julia --project=JSON3 -J sysimage_test.so -e 'using Pkg; Pkg.test()'`

When I change the UUID of my local copy of `JSON3` and try to `using JSON3`, I get the above error.

I hope this explanation makes things more clear.

---

<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:40pm UTC](https://discourse.julialang.org/t/developing-packages-that-are-already-in-the-loaded-sysimage/77950/7 "2022-04-08T16:40:04Z")

</div>

Here’s what finally worked for me -

- Change the UUID of the local copy of package (`JSON3`)
- Import the local copy (as opposed to the copy in the sysimage) the following way -  
`import JSON3 as JSON3LocalCopy`.  
This will allow you to use the latest version of the package you’re developing, even if the said package is already present within the sysimage loaded.
