Trouble with new local package

I am mostly familiar with Python’s packaging … but I am trying to start a new package for my application. Surely I am getting something wrong.

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.0 (2023-05-07)
 _/ |\__'_|_|_|\__'_|  |
|__/                   |

(@v1.9) pkg> generate Stuff
  Generating  project Stuff:
    Stuff/Project.toml
    Stuff/src/Stuff.jl

(@v1.9) pkg> activate Stuff/
  Activating project at `~/Projects/Julia/Stuff`

(Stuff) pkg> status
Project Stuff v0.1.0
Status `~/Projects/Julia/Stuff/Project.toml` (empty project)

(Stuff) pkg> add FFTW
   Resolving package versions...
ERROR: cannot find name corresponding to UUID a63ad114-7e13-5084-954f-fe012c677804 in a registry

(Stuff) pkg> add NetCDF
   Resolving package versions...
ERROR: cannot find name corresponding to UUID a63ad114-7e13-5084-954f-fe012c677804 in a registry

(Stuff) pkg>```

I deleted ~/.julia and the Stuff folder … restarted Julia, re-generated the Stuff project and got the same error:

(Stuff) pkg> add FFTW
   Resolving package versions...
ERROR: cannot find name corresponding to UUID a63ad114-7e13-5084-954f-fe012c677804 in a registry

I don’t know if this is related, but this is the banner I get when I start Julia:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.0 (2023-05-07)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

Yours is missing the “Offical release” note at the bottom.

Ah, I git cloned the repo, then git checkout v1.9.0 … if that makes a difference.
After that I just ran make -j4 in the directory …

Maybe pkg> instantiate? Perhaps you never downloaded the General registry?

Also, PkgTemplates.jl is highly recommended for anything you intend to share with others. It sets up all the CI/documentation skeleton/etc for you, and is part of what contributes to that impression I’ve heard from many Python programmers, “wow, Julia packages are so consistent in their structure!”

would pkg> update download everything, or must it be pkg> instantiate?
Ok, clearly from the documentation, instantiate does the downloading (I didn’t do that). Must I do that in the “root” environment, or just ignore the root environment and only work on sub-environment/package things?

Unless you are planning to develop Julia itself, you are taking a hard path. Just download the binary from the Julia site or install juliaup and install Julia with it, and things will probably work. (and the use PkgTemplates)

See: GitHub - JuliaLang/juliaup: Julia installer and version multiplexer

Juliaup sounds neat, sort of like rustup? I’ll check it out.

2 Likes

It shouldn’t be this hard. Did you just try it? Once the general registry is downloaded for your depot, you should be all set (it no longer depends on the specific environment).

I hadn’t issued “pkg instantiate” that did the trick. I should have been more explicit, but I had marked your suggestion to issue the instantiate command as a solution.

1 Like

There must be something unusual going on here. The expected result of doing those operations in an empty depot (pointing JULIA_DEPOT_PATH to an empty directory is effectively equivalent to deleting .julia) is:

$ cd /tmp
$ mkdir testdepot
$ JULIA_DEPOT_PATH=/tmp/testdepot julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.0 (2023-05-07)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(@v1.9) pkg> generate Stuff
  Generating  project Stuff:
    Stuff/Project.toml
    Stuff/src/Stuff.jl

(@v1.9) pkg> activate Stuff
  Activating project at `/tmp/Stuff`

(Stuff) pkg> status
  Installing known registries into `/tmp/testdepot`
Project Stuff v0.1.0
Status `/tmp/Stuff/Project.toml` (empty project)

(Stuff) pkg> add FFTW
    Updating registry at `/tmp/testdepot/registries/General.toml`
   Resolving package versions...
   Installed Preferences ───── v1.4.0
   [...]

Did you do something else before these operations?

1 Like

What you wrote is essentially what I did, but I remember it erroring out. I have some spare time to try it again fresh from the clone. I’ll make distclean in the git repo and delete ~/.julia again and post back.

# previously (i.e. yesterday)
# git clone https://github.com/JuliaLang/julia.git
# git checkout v1.9.0
rm -rf ~/.julia
cd ~/opt/julia
make clean
make distclean
make -j8
julia

And from the Julia session

]
generate Stuff
activate Stuff
add FFTW

and it worked without complaint! :man_shrugging:
Conclusion: yesterday was cursed somehow.
Note: I did not refresh my clone from yesterday, so any changes made remotely would not be the issue either.

1 Like