# Julia \`Pkg\` seems to look in the wrong place when installing private package in Github CI

**URL:** <https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694>\
**Category:** General Usage\
**Created:** [March 28, 2023, 4:15am UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694 "2023-03-28T04:15:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [March 28, 2023, 4:15am UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/1 "2023-03-28T04:15:19Z")

</div>

I am using Github CI for package development. My package is private, and it has dependencies on some other private packages that I developed. While I can successfully clone the private dependency packages from github into the CI server, when CI goes to install those packages, it fails.

I was hoping someone might be able to see where I am making a mistake. Here is the relevant section of the `CI.yml` file.

```julia
      - name: Clone JuliaGendUniv_Types
        run: git clone git@github.com:university-gender-evolution/JuliaGendUniv_Types.jl.git
      - name: Clone JuliaGendUniv
        run: git clone git@github.com:university-gender-evolution/JuliaGendUniv.jl.git
      - name: Check file download was successful
        run: |
          pwd
          ls -lah
      - name: Install JuliaGendUniv private repo
        run: julia --project -e 'using Pkg; Pkg.add(; path="JuliaGendUniv.jl")'
      - name: Install JuliaGendUniv_Types private repo
        run: julia --project -e 'using Pkg; Pkg.add(; path="JuliaGendUniv_Types.jl")'

```

So I can see that the files are downloaded to CI since I have an instruction to list the directory structure. The image below is from the CI server output.

```julia
drwxr-xr-x 9 runner docker 4.0K Mar 28 00:04 .
drwxr-xr-x 3 runner docker 4.0K Mar 28 00:04 ..
drwxr-xr-x 8 runner docker 4.0K Mar 28 00:04 .git
drwxr-xr-x 3 runner docker 4.0K Mar 28 00:04 .github
-rw-r--r-- 1 runner docker 138 Mar 28 00:04 .gitignore
drwxr-xr-x 8 runner docker 4.0K Mar 28 00:04 JuliaGendUniv.jl
drwxr-xr-x 7 runner docker 4.0K Mar 28 00:04 JuliaGendUniv_Types.jl
-rw-r--r-- 1 runner docker 1.1K Mar 28 00:04 LICENSE
-rw-r--r-- 1 runner docker 95K Mar 28 00:04 Manifest.toml
-rw-r--r-- 1 runner docker 731 Mar 28 00:04 Project.toml
-rw-r--r-- 1 runner docker 681 Mar 28 00:04 README.md
drwxr-xr-x 3 runner docker 4.0K Mar 28 00:04 docs
drwxr-xr-x 3 runner docker 4.0K Mar 28 00:04 src
drwxr-xr-x 2 runner docker 4.0K Mar 28 00:04 test

```

The error I am getting is below. Seems like the CI server is trying to install the package from the wrong location? The message reads:

```julia
ERROR: expected package `JuliaGendUniv_Types [603251c8]` to exist at path `/home/runner/.julia/packages/JuliaGendUniv_Types/ZJncY`

```

Here is the output from the CI server.

```julia
Run julia --project -e 'using Pkg; Pkg.add(; path="JuliaGendUniv.jl")'
  Installing known registries into `~/.julia`
     Cloning git-repo `/home/runner/work/JuliaGendUniv_Optimize.jl/JuliaGendUniv_Optimize.jl/JuliaGendUniv.jl`
    Updating git-repo `/home/runner/work/JuliaGendUniv_Optimize.jl/JuliaGendUniv_Optimize.jl/JuliaGendUniv.jl`
    Updating registry at `~/.julia/registries/General.toml`
   Resolving package versions...
ERROR: expected package `JuliaGendUniv_Types [603251c8]` to exist at path `/home/runner/.julia/packages/JuliaGendUniv_Types/ZJncY`
Stacktrace:
  [1] pkgerror(msg::String)
    @ Pkg.Types /opt/hostedtoolcache/julia/1.8.5/x86/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
  [2] collect_fixed!(env::Pkg.Types.EnvCache, pkgs::Vector{Pkg.Types.PackageSpec}, names::Dict{Base.UUID, String})

```

Seems like the Package manager is looking in `/home/runner/.julia/packages/JuliaGendUniv_Types/ZJncY` instead of `/home/runner/work/JuliaGendUniv_Optimize.jl/JuliaGendUniv_Optimize.jl/JuliaGendUniv.jl`.

I am also wondering if this has anything to do with the `Manifest.toml` file being in the repository? I had to do that since I am pulling in a private repository and I get some strange errors if I don’t include the manifest with the specific github directory referenced.

Any suggestions would be appreciated. I have kinda exhausted my debugging muscles.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 28, 2023, 6:03am UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/2 "2023-03-28T06:03:00Z")

</div>

I suspect that the problem is that `JuliaGendUniv_Types` is a dependency of `JuliaGendUniv` and since they are unregistered you need to install the dependency first.

---

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [March 28, 2023, 2:12pm UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/3 "2023-03-28T14:12:14Z")

</div>

Thanks for the response @GunnarFarneback . It is kinda strange. So the `JuliaGendUniv` package is the older package and I am trying to break it into smaller packages. So the `JuliaGendUniv_Types` package and `JuliaGendUniv` don’t depend on each other. I believe that `JuliaGendUniv_Types` needs `JuliaGendUniv` for testing, but that is it.

It is odd though, because if I try to install only the Types package, then CI complains that the `JuliaGendUniv` old package is not present. If I try and install the `JuliaGendUniv` old package, then CI complains that the Types package is not present. So just went through and checked and could not find any dependencies between projects, but perhaps there is something buried in there somewhere, and I have to keep digging?

Also, do you happen to know whether I need to keep the `Manifest.toml` in the private repositories. I think I do, but I want to make sure this does not mess anything thing up. When I tried to remove them, `Pkg` could no longer find the link to the packages to update them. But as I have seen in the past, we don’t usually save the Manifest with the package. So if you happen to know the correct thing to do there, please pass it along. Otherwise, I will keep digging :).

Thanks again.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 28, 2023, 2:23pm UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/4 "2023-03-28T14:23:38Z")

</div>

Whether there are any dependencies between the packages should be visible in the respective `Project.toml` files.

Unregistered packages can be tricky to work with outside your own Julia installation. Arguably the best solution is to register them, and you can do that in a registry of your own with the help of [GitHub - GunnarFarneback/LocalRegistry.jl: Create and maintain local registries for Julia packages.](https://github.com/GunnarFarneback/LocalRegistry.jl)

---

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [March 28, 2023, 2:29pm UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/5 "2023-03-28T14:29:03Z")

</div>

Oh interesting. I was just reading your link. I have not registered a package before, so I am not very familiar with the process. But I am still very early in development, so I was trying to keep things private until all the pieces are working. Does it still make sense to register even private packages? Like is there a way to keep the code private and still register it. And then make the package public once everything works?

Is there a video or something on this. It always helps to watch someone do it, if that is available :).

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 28, 2023, 2:32pm UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/6 "2023-03-28T14:32:26Z")

</div>

The idea would be to make your own personal registry, which you can keep as private as you wish. Registering packages in your own registry has a very low overhead compared to registering a public package in the General registry.

---

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [March 28, 2023, 2:34pm UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/7 "2023-03-28T14:34:48Z")

</div>

Okay cool. I will try and make a simple dummy package, and see if I can get the local registry to work. If I can get a personal registry to work, would I still be able to use that with the Github CI? I am not clear on that part. Or would I need to setup a separate registry server for that.

---

<div class="post-metadata">

**Author:** ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)\
**Post date:** [March 28, 2023, 2:44pm UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/8 "2023-03-28T14:44:43Z")

</div>

The registry is just a git repository and if you host it on GitHub you should be able to use it from Github CI, provided that you know how to setup tokens or whatever is needed for authentication to your private repositories.

I don’t have any private GitHub repositories myself but there’s some related discussion in [Private registry](https://discourse.julialang.org/t/private-registry/68291).

---

<div class="post-metadata">

**Author:** ![00krishna](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/00krishna/32/8843_2.png) [@00krishna](https://discourse.julialang.org/u/00krishna)\
**Post date:** [March 28, 2023, 2:48pm UTC](https://discourse.julialang.org/t/julia-pkg-seems-to-look-in-the-wrong-place-when-installing-private-package-in-github-ci/96694/9 "2023-03-28T14:48:15Z")

</div>

Sounds good @GunnarFarneback . I will read through the docs and then give it a try. Thanks again for all of your help and all the information.
