Using a manually downloaded package

I recently manually downloaded a package for Julia. Where should I put the folder ? (I would prefer to put the package in the working directory in my situation). Then, how should I “include/import/using” it ? At the moment, the Touchstone package is considered as not defined.

Specific info: the package I am trying to use is Touchstone.jl. I put it in the working directory (directory of the Main module).

module Main
import .Touchstone
Touchstone.parse_touchstone_file(joinpath(@__DIR__, "sparam.s24p" ))
end
WARNING: replacing module Main.
WARNING: could not import Main.Touchstone into Main
ERROR: UndefVarError: Touchstone not defined
Stacktrace:
 [1] top-level scope at REPL[2]:4

I would recommend that you just do the following:

julia> import Pkg

julia> Pkg.add(url = "https://github.com/mpichl87/Touchstone.jl")

julia> import Touchstone
2 Likes

An easier way (and to remember) is just, after typing ]:

(@v1.6) pkg> add https://github.com/mpichl87/Touchstone.jl

then I just use using, isn’t that the preferred way? I rarely use import at least not instead, is that better in this case?

1 Like

From my little experience, it depends on your project. I would typically import all the .jl I have personally written, such that it is evident when I call a function from them: myJuliaModule.myFunction(), and it does not conflict with anything else.