packagejuliamathematical-optimization

Julia - getting started with local compiled Pkg


This is on Julia 1.9.3. I'm trying to use the high precision arithmetic and the Remez.jl package to test out some ideas. I have the code and it compiles OK. I can do toy things in Julia as a language but I haven't been able to figure out how to make the compiled "Remez" local package visible to the julia environment to run the initial runtests.jl or to my code. This is the console output and I have looked at various suggestions on SO and tried them to no avail. I'm pretty sure this is a classic newbie error in the Julia environment but I just haven't found the right FAQ. Please can someone tell me what it is I am doing wrong here?

$ julia Remez.jl
$ julia runtests.jl
ERROR: LoadError: ArgumentError: Package Remez not found in current path.
- Run `import Pkg; Pkg.add("Remez")` to install the Remez package.
Stacktrace:
[1] macro expansion
@ ./loading.jl:1630 [inlined]
[2] macro expansion
@ ./lock.jl:267 [inlined]
[3] require(into::Module, mod::Symbol)
@ Base ./loading.jl:1611
in expression starting at /home/martin/Downloads/runtests.jl:1
$ import Pkg; Pkg.add("Remez")
bash: syntax error near unexpected token `"Remez"'
$ Run 'import Pkg; Pkg.add("Remez")'
Command 'Run' not found, did you mean:
[snip]
$ import Pkg; Pkg.add("Remez")
bash: syntax error near unexpected token `"Remez"'
$ using Pkg; Pkg.add("Remez")
bash: syntax error near unexpected token `"Remez"'
$ import Pkg; Pkg.add(".Remez")
bash: syntax error near unexpected token `".Remez"'
$ julia -v
julia version 1.9.3

And a few other permutations all with the same no-can-do result. Thanks for the first answer I had hoped that it would fix things but unfortunately I still get exactly the same error message. I include the relevant Project.toms file below. I don't really understand how it works.

name = "Remez"
uuid = "2e7db186-766a-50e7-8928-5c30181fb135"
authors = ["Simon Byrne <redacted>"]
version = "0.1.1"

[compat]
julia = "1.0"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

Thanks for any enlightenment. I'm sure it is something really stupid


Solution

  • In the shell, start julia with julia. This will lead you to be in a Julia terminal, recognisable by a julia> prompt.

    From there you can first add your desired pachage: import Pkg; Pkg.add("Remez").

    This should install the Remez package in the default environment, and need to be done only once. After that, you can import it with using Remez and use the functions that the package makes available.

    Of course if you don't want to work in the teminal, you can use a development editor like VSCode with the Julia plugin (you still need to have Julia installed in your pc, but this you already have).