Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Julia packages using a .toml file?

I am totally new to Julia!

I would like to install a large number of packages for a project I'm joining.

The project comes with a "Project.toml" file

It seems like there should be a nice way to install all the packages I need for the project, perhaps using the Project.toml file

However, I have not yet found any site that indicates how I might be able to do this.

Could anyone please let me know if what I am doing is possible, and if so, point me to a reference that would show how?

like image 356
seeker_after_truth Avatar asked Feb 06 '26 18:02

seeker_after_truth


2 Answers

If your Project.toml is located in a folder, like myproject/Project.toml, you can simply start Julia with julia --project=/path/to/myproject, and it will automatically detect the Project.toml file in myproject.

The first time you activate this project, in the REPL, you can switch to Pkg mode by typing ], and type the command instantiate. This will cause the package manager to download and install all of the packages listed in Project.toml and their dependencies.

Another way to switch between projects during interactive use is to run activate /path/to/myproject in Pkg-mode in the REPL.

like image 59
Anshul Singhvi Avatar answered Feb 09 '26 12:02

Anshul Singhvi


How to install julia packages from a Project.toml

First, you will have navigate to the folder containing your Project.toml.

cd ../your-folder-containing-the-project.toml-file

in your terminal:

julia --project=.

]

instantiate

or

julia --project=. -e 'using Pkg; Pkg.instantiate()

like image 37
Koops Avatar answered Feb 09 '26 12:02

Koops