# How to completely remove a local package?

**URL:** <https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799>\
**Category:** New to Julia\
**Tags:** package, installation\
**Created:** [July 9, 2020, 7:39pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799 "2020-07-09T19:39:32Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunjin](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sunjin](https://discourse.julialang.org/u/sunjin)\
**Post date:** [July 9, 2020, 7:39pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/1 "2020-07-09T19:39:32Z")

</div>

I am new to julia and I recently developed an experimental package using these procedures: `generate mypackge`, entered the directory, followed by `activate .` and `dev .`, and `add mypackage` to be able to do `using mypackage` and begin calling functions defined in the .jl file. All these were done by poking around and finding fractions of instructions from all over the internet. I honestly don’t know very well what these commands does.

Later I created a git repo on bitbucket, and hosted the package there without registering ( I think, I don’t know what to do to register). I did `rm mypackage` and verified I can no longer do `using mypackage`, but I can still do ‘add mypackage’, where pkg tells me that this package is identified with my local directory of `mypackage`. I next attempted to add the same package from bitbucket by doing `add git@<url>:mypackage.jl.git`, and got the following error:  
`ERROR: it is invalid to specify multiple packages with the same UUID: <xxxx>`

I am not that surprised, but would like to know how to completely remove information about the local package and be able to install from the git repo. Can anyone help me with this?  
I am also curious about what `dev mypackage` does? Why I cannot add the package without first doing ‘dev’?  
I’m using windows 10 and Julia 1.4.2.

---

<div class="post-metadata">

**Author:** ![ppalmes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ppalmes/32/6838_2.png) [@ppalmes](https://discourse.julialang.org/u/ppalmes)\
**Post date:** [July 9, 2020, 7:53pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/2 "2020-07-09T19:53:39Z")

</div>

try ]free mypackage

---

<div class="post-metadata">

**Author:** ![sunjin](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sunjin](https://discourse.julialang.org/u/sunjin)\
**Post date:** [July 9, 2020, 7:56pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/3 "2020-07-09T19:56:24Z")

</div>

Thank you but unfortunately I got  
ERROR: unable to free unregistered package xxxx

---

<div class="post-metadata">

**Author:** ![ppalmes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ppalmes/32/6838_2.png) [@ppalmes](https://discourse.julialang.org/u/ppalmes)\
**Post date:** [July 9, 2020, 7:58pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/4 "2020-07-09T19:58:43Z")

</div>

]rm mypackage  
]add (bitbucket link)

---

<div class="post-metadata">

**Author:** ![sunjin](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sunjin](https://discourse.julialang.org/u/sunjin)\
**Post date:** [July 9, 2020, 8:02pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/5 "2020-07-09T20:02:48Z")

</div>

That’s what I did originally, first removing the package then adding the git repo. I got the error

> ERROR: it is invalid to specify multiple packages with the same UUID: xxxx

as I posted. I should mention that bitbucket changed the name to all lower case while my local package name is `MyPackage`. I guess that’s where the “multiple packages” came from?

---

<div class="post-metadata">

**Author:** ![ppalmes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ppalmes/32/6838_2.png) [@ppalmes](https://discourse.julialang.org/u/ppalmes)\
**Post date:** [July 9, 2020, 8:04pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/6 "2020-07-09T20:04:21Z")

</div>

mv ~/.julia ~/.julia1  
start julia and install packages

---

<div class="post-metadata">

**Author:** ![sunjin](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sunjin](https://discourse.julialang.org/u/sunjin)\
**Post date:** [July 9, 2020, 8:06pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/7 "2020-07-09T20:06:53Z")

</div>

Thanks but too much brute force and does not help me understand

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [July 9, 2020, 8:23pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/8 "2020-07-09T20:23:35Z")

</div>

`dev` and `add` do different things. See this answer in a recent thread (the original question was different, but may give you another perspective to understand what is happening):

> [@Packages under /.julia/dev/ shared by different versions of Julia?](https://discourse.julialang.org/t/packages-under-julia-dev-shared-by-different-versions-of-julia/42537/7):
>
> Are you actually intending to edit the code in the cloned version of the package? Or are you just trying to have two different versions of A as dependencies for two different versions of Julia? If the latter, don’t develop A; instead Pkg.add the version that you want to pin for the older Julia version. Note also that you can always download a new version of A to anywhere you want using any method you want. If you then develop(path/toA) you will use that version of A in that particular environm…

A more detailed explanation of the main pkg commands here:  
[https://julialang.github.io/Pkg.jl/v1/managing-packages/](https://julialang.github.io/Pkg.jl/v1/managing-packages/)

For your particular case, if the dev’ed version of ’ MyPackage`lives in`.julia/dev`, maybe it’s still finding that it is there, and there might be a conflict due to the lowercase/camelcase names, but I’m not sure.

You can try to check if that’s what is happening: if the package is in `.julia/dev`, move it to another place (e.g. outside `.julia`), and try `add` again. Let’ see what happens.

---

<div class="post-metadata">

**Author:** ![mbaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbaz/32/17295_2.png) [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Post date:** [July 9, 2020, 8:24pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/9 "2020-07-09T20:24:30Z")

</div>

I believe that removing a package doesn’t actually delete it from `~/.julia/packages`. I’d try removing it with `rm -r ~/.julia/packages/<yourpackage>`.

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [July 9, 2020, 8:26pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/10 "2020-07-09T20:26:19Z")

</div>

Without knowing more about your setup and what exactly you did, it’s hard to say, but when you do `]dev SomePackage`, that package gets cloned to your system (usually in `~/.julia/dev`) and then the package manager will not touch it, ever. Things like `]free SomePackage` and `]rm SomePackage` will free/remove the reference from your environment, but will not delete the folder.

I’m not sure why you’re getting the UUID collision, unless you changed the name of the package (in the `Project.toml` or something) without changing the UUID.

My suggestions:

1. use `git` to your advantage. If you’ve got a locally `dev'd` version, use git to update it / change it. Git allows you to have multiple remotes, multiple branches etc.
2. Double check in your `~/.julia/dev` directory that your old version is not still lying around. If it is, and you don’t want to delete it, you can always change the UUID (it’s set in the `Project.toml`, and you can get a new one with `using UUIDs; uuid4()`

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [July 9, 2020, 8:27pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/11 "2020-07-09T20:27:41Z")

</div>

Just to be sure: you restarted Julia after removing the package?

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [July 9, 2020, 8:28pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/12 "2020-07-09T20:28:24Z")

</div>

Oh, yes, that might be also the case. But I don’t like tinkering with the contents of `.julia/packages` myself. If the `add`-ed version was removed and not used in any environment anymore, `]gc` should do the same in a safe manner, I think.

---

<div class="post-metadata">

**Author:** ![hendri54](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hendri54/32/9621_2.png) [@hendri54](https://discourse.julialang.org/u/hendri54)\
**Post date:** [July 9, 2020, 8:30pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/13 "2020-07-09T20:30:43Z")

</div>

There is no problem having multiple versions of a package stored on your computer somewhere. It happens all the time because you can use multiple versions in different environments.

It would help to see the Project.toml / Manifest.toml for the environment where you are trying to add.

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [July 9, 2020, 8:34pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/14 "2020-07-09T20:34:03Z")

</div>

> [@kevbonham](#):
>
> I’m not sure why you’re getting the UUID collision, unless you changed the name of the package (in the `Project.toml` or something) without changing the UUID.

Actually:

> [@sunjin](#):
>
> I should mention that bitbucket changed the name to all lower case while my local package name is `MyPackage` . I guess that’s where the “multiple packages” came from?

---

<div class="post-metadata">

**Author:** ![kevbonham](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevbonham/32/216165_2.png) [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Post date:** [July 9, 2020, 8:35pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/15 "2020-07-09T20:35:36Z")

</div>

Yeah - but I thought that the relevant name would be the one found in `Project.toml`, not the directory name

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [July 9, 2020, 8:35pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/16 "2020-07-09T20:35:54Z")

</div>

> [@sunjin](#):
>
> I should mention that bitbucket changed the name to all lower case while my local package name is `MyPackage` .

Yeah, this is a really annoying “feature” of Bitbucket. I recommend GitHub and/or GitLab instead. Of course, if you are required to use Bitbucket by your organization, that doesn’t help you much.

---

<div class="post-metadata">

**Author:** ![heliosdrm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/heliosdrm/32/3851_2.png) [@heliosdrm](https://discourse.julialang.org/u/heliosdrm)\
**Post date:** [July 9, 2020, 8:38pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/17 "2020-07-09T20:38:23Z")

</div>

I’m not using Bitbucket so I don’t know, but maybe it’s not only the directory name, but also the name of the source files (e.g. `src/MyPackage.jl` \> `src/mypackage.jl`)?

---

<div class="post-metadata">

**Author:** ![dilumaluthge](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dilumaluthge/32/29283_2.png) [@dilumaluthge](https://discourse.julialang.org/u/dilumaluthge)\
**Post date:** [July 9, 2020, 8:41pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/18 "2020-07-09T20:41:23Z")

</div>

Anyway, to address the initial question, sometimes it can be hard to debug these Pkg problems. @ppalmes’s answer is a reliable way to fix these things.

---

<div class="post-metadata">

**Author:** ![sunjin](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@sunjin](https://discourse.julialang.org/u/sunjin)\
**Post date:** [July 9, 2020, 8:47pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/19 "2020-07-09T20:47:02Z")

</div>

> [@heliosdrm](#):
>
> For your particular case, if the dev’ed version of ’ MyPackage `lives in` .julia/dev`, maybe it’s still finding that it is there, and there might be a conflict due to the lowercase/camelcase names, but I’m not sure.

Thanks for your response. Somehow even though I `dev`ed my package, my `~/.julia/` folder does not contain a `dev` folder, which may be strange. The difference in the upper/lower cases of the repo name and package name (.jl file name and module name) may not really matter, but I attempted the following

> ]add “[git@bitbucket.com](mailto:git@bitbucket.com):xxxx/mypackage.jl.git” “MyPackage”

following some online instruction which seems to be outdated. I later did the following: restart REPL, `]rm MyPackage`, delete the `~/.julia/packages/MyPackage/` folder, restart again and do

> ]add “[git@bitbucket.com](mailto:git@bitbucket.com):xxxx/mypackage.jl.git”

to make it work. I don’t know which step is critical though, but I’m glad it got resolved.

---

<div class="post-metadata">

**Author:** ![ppalmes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ppalmes/32/6838_2.png) [@ppalmes](https://discourse.julialang.org/u/ppalmes)\
**Post date:** [July 9, 2020, 8:47pm UTC](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799/20 "2020-07-09T20:47:23Z")

</div>

if you want to understand what went wrong, add similar packages including yourpackage with the new .julia and diff .julia .julia1 to see which part causes the duplication issue.

[Next page](https://discourse.julialang.org/t/how-to-completely-remove-a-local-package/42799.md?page=2)
