# Pkg problem with Julia 1.1

**URL:** <https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787>\
**Category:** General Usage\
**Created:** [September 15, 2019, 11:08am UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787 "2019-09-15T11:08:26Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [September 15, 2019, 11:08am UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/1 "2019-09-15T11:08:26Z")

</div>

I’m testing an updated package developed by a collaborator. The updated package doesn’t install; instead, the old package (which I have renamed on my computer) gets installed. I use Julia v. 1.1 on Windows 10, 64 bit, latest version.

The updated package is available on collaborator’s github site, but I have also downloaded it manually and put it on my hard drive. I have added the path of the package in my .julia/config/startup.jl file. Here is what I do:

- I use Pkg manager to remove the old version, Pkg.rm(“pkgname”).
- I go into the .julia/packages directory and delete the directory associated with the package.
- I restart my computer.
- I _add_ the package using the Pkg manager

Although I have renamed the old package, it is still the old package that is available when I import the package into Julia. So the old package must be stored somewhere in the Julia system without me knowing it… and in such a way that the old package gets installed instead of the new package.

Questions:

1. Where could the old package be stored? Is there a way to remove it ( Pkg.rm(“pkgname”) ) doesn’t remove it properly from the system…
2. I assume that the reason why the package is not properly removed/handled is that something is missing in the package set-up. What could this this missing set-up be?

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 15, 2019, 11:44am UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/2 "2019-09-15T11:44:00Z")

</div>

> [@BLI](#):
>
> downloaded it manually and put it on my hard drive. I have added the path of the package in my .julia/config/startup.jl file

It is better to just `pkg> add` or `pkg> dev` it in your default environment.

> [@BLI](#):
>
> - I go into the .julia/packages directory and delete the directory associated with the package.
> - I restart my computer.

These steps should not be necessary.

> [@BLI](#):
>
> Questions:
> 
> 1. Where could the old package be stored? Is there a way to remove it ( Pkg.rm(“pkgname”) ) doesn’t remove it properly from the system…
> 2. I assume that the reason why the package is not properly removed/handled is that something is missing in the package set-up. What could this this missing set-up be?

To answer this, it would be good to know what exactly you do in `.startup.jl`, but note that this is not the way to do it. See

[https://julialang.github.io/Pkg.jl/v1/managing-packages/#Adding-unregistered-packages-1](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Adding-unregistered-packages-1)

---

<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:** [September 15, 2019, 11:51am UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/3 "2019-09-15T11:51:31Z")

</div>

`Pkg.add(path to github)` does it.

This downloads the latest commit from the repo (or the one that you specify with an sha).

---

<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:** [September 15, 2019, 12:01pm UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/4 "2019-09-15T12:01:42Z")

</div>

Please write down your exact commands that you use and what output you get. Stuff like `I add the package using the Pkg manage` could mean a lot of different things.

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [September 15, 2019, 3:42pm UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/5 "2019-09-15T15:42:04Z")

</div>

Sorry for delayed response – I was out on a hike…

OK: I _removed_ the package using `Pkg.rm("pkg_name")`. Then I _deleted_ my “private” download. Finally, I tried to `Pkg.add("github_address")`. I’m then told that the “github\_address” is not a valid address. So I do `Pkg.clone("github_address")`. I’m then told that `clone` is outdated, and that I should use `add` – but it still procedes to try to install the package…

```julia
julia> Pkg.clone("https://github.com/software/pkg_name.jl")
┌ Warning: Pkg.clone is only kept for legacy CI script reasons, please use `add`
└ @ Pkg.API C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.1\Pkg\src\API.jl:391
  Updating registry at `C:\Users\myself\.julia\registries\General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Updating git-repo `https://github.com/software/pkg_name.jl`
[ Info: Path `C:\Users\myself\.julia\dev\pkg_name` exists and looks like the correct package, using existing path
 Resolving package versions...
  Updating `C:\Users\myself\.julia\environments\v1.1\Project.toml`
  [0f4fe800] + pkg_name v0.1.0+ [`C:\Users\myself\.julia\dev\pkg_name`]
  Updating `C:\Users\myself\.julia\environments\v1.1\Manifest.toml`
  [0f4fe800] + pkg_name v0.1.0+ [`C:\Users\myself\.julia\dev\pkg_name`]

```

1. OK… `Pkg.add()` doesn’t work, but `Pkg.clone()` works with a warning. Am I supposed to use `Pkg.dev()` here?
2. I observe that an old version of the package is located at `.julia\dev\`… and in fact the package manager thinks this is the same as the one I try to install. I _guess_ that because of this, the Pkg manager actually doesn’t install the new code…??
3. Why does the package manager confuse the two versions of the package. Hm… I asked the developer for the version number of the new code. My impression is that they have not specified the version number, or that they perhaps use the same version number for both the old version and the new version. Could this explain the confusion of the package manager?

I next experimented with the `dev` command. I thus removed the package again (`Pkg.rm("pkg_name")`), and then tried `Pkg.dev("https://github.com/software/pkg_name.jl")`. Response: `dev` is not defined. Then I switched to the Pkg environment and did `pkg> dev https://github.com/software/pkg_name.jl`. This time, the software was installed. But with the same comment as before that the package already was installed…

_Question_: Is it correct that `dev` is not available from `Pkg.dev()` ? (I tend to import `Pkg` and use the syntax `Pkg.command()` because this can be scripted…)

**Finally** , I have deleted directory `pkg_name` from `.julia\dev\` as well as from `.julia\packages\`. Next, I used `Pkg.clone()` to install the package from `github`.

This time, there was no complaint that the the package already existed in `dev` subdirectory, and the new package was installed in `.julia\dev\`… And this time, nothing was installed in `.julia\packages`…

What bugs me is that the code still behaves like the old version…

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 15, 2019, 3:48pm UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/6 "2019-09-15T15:48:43Z")

</div>

> [@BLI](#):
>
> Am I supposed to use `Pkg.dev()` here?

If you insist on that API, it is `Pkg.develop`.

(Doing this by trial and error may be somewhat frustrating, perhaps consider reading the docs).

> [@BLI](#):
>
> I _guess_ that because of this, the Pkg manager actually doesn’t install the new code…??

It will not overwrite existing directories:

[https://julialang.github.io/Pkg.jl/dev/managing-packages/#Developing-packages-1](https://julialang.github.io/Pkg.jl/dev/managing-packages/#Developing-packages-1)

But `pkg> up` should update to the latest version.

You may find `pkg> status` useful in investigating problems like this.

---

<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:** [September 15, 2019, 5:27pm UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/7 "2019-09-15T17:27:55Z")

</div>

> [@BLI](#):
>
> Finally, I tried to `Pkg.add("github_address")` . I’m then told that the “github\_address” is not a valid address.

You are just using the function wrong, if you look at the docstring:

```julia
help?> Pkg.add
  Pkg.add(pkg::Union{String, Vector{String}})
  Pkg.add(pkg::Union{PackageSpec, Vector{PackageSpec}})

  Add a package to the current project. This package will be available using the import and using keywords in the Julia REPL and if the current project is a package, also inside that package.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  Pkg.add("Example") # Add a package from registry
  Pkg.add(PackageSpec(name="Example", version="0.3")) # Specify version
  Pkg.add(PackageSpec(url="https://github.com/JuliaLang/Example.jl", rev="master")) # From url to remote gitrepo
  Pkg.add(PackageSpec(url="/remote/mycompany/juliapackages/OurPackage"))` # From path to local gitrepo

  See also PackageSpec.

```

you see that the correct usage is

```julia
Pkg.add(PackageSpec(url = "github _adress"))

```

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [September 15, 2019, 5:42pm UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/8 "2019-09-15T17:42:49Z")

</div>

Thanks! I’ll test it out – probably tomorrow.

What about if there is no “version” specified in the package? Would that cause problems if I try to `add` the package, and the package manager finds another version without version specification? Will the package manager believe that the packages are the same?

---

<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:** [September 15, 2019, 7:26pm UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/9 "2019-09-15T19:26:59Z")

</div>

No, there will be no confusion. `add` retrieves the latest from github (unless you specify an sha in the `PackageSpec`, but specifying an sha may only work for `up`, the way I read the Pkg docs).

And, as the docs say, but potentially easy to overlook:

`Pkg.add(PackageSpec(...))`

but

`pkg> add https://github.com/path/to/package`

---

<div class="post-metadata">

**Author:** ![BLI](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bli/32/37206_2.png) [@BLI](https://discourse.julialang.org/u/BLI)\
**Post date:** [September 16, 2019, 7:56am UTC](https://discourse.julialang.org/t/pkg-problem-with-julia-1-1/28787/10 "2019-09-16T07:56:20Z")

</div>

Thanks again. `Pkg.add(PackageSpec(url="...githubaddress..."))` solved the problem.
