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.
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?
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):
For your particular case, if the dev’ed version of ’ MyPackagelives 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.
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:
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.
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()
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.
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.
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.
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)?
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.
Thanks for your response. Somehow even though I deved 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
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
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.