Install a packages from a list

Hi ,
I need to install packages from a list.
I was wondering if julia has an a command to install from list.
like python’s "pip install -r requirements.txt " ?

Thanks.

Yes.

You can use Pkg to install multiple packages (https://github.com/JuliaLang/julia/issues/19591). For instance: Pkg.add(["Combinatorics", "TaylorSeries"]).

If your list sits in a text file, you can just load it and pass it to Pkg.add.

4 Likes

I don’t know of any built in command like this. But writing a little script for this seems simple and straightforward: read the file and use Pkg.add(pkgname) to add them one after another.

2 Likes

Ok , I will try it.
Thank you for your help

Of course, the Manifest.toml is made for this purpose or actually Project.toml depending how you will want to use the list.

1 Like

@ilango3 The We can create a requirements.txt Python equivalent by creating a julia script
packages.jl

The contents of the packages.jl will be,

using Pkg

dependencies = [
    "IJulia",
    "Genie"
]

Pkg.add(dependencies)

We can add more dependencies in this list.
This can be executable with the command julia packages.jl

2 Likes

note for most purposes the julia equiv of a requirements.txt is a Project.toml
but you can’t write one by hand.

1 Like