-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallRequirements.jl
More file actions
32 lines (30 loc) · 978 Bytes
/
installRequirements.jl
File metadata and controls
32 lines (30 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Pkg module for managing packages
using Pkg
# Define the path to the file containing required package names
package_file = "/data/miraldiNB/Katko/Projects/Julia2/Testing/Packages.txt"
# Read package names from the file
required_packages = []
if isfile(package_file)
# Open the file and read package names
open(package_file) do file
for line in eachline(file)
line = strip(line)
if !isempty(line)
push!(required_packages, line)
end
end
end
else
println("Error: Package requirements file '$package_file' not found.")
exit(1)
end
# Check and install required packages
for pkg in required_packages
try
eval(Meta.parse("using $pkg")) # check if package already exist by loading
catch
println("Installing $pkg...") #install package if not installed
Pkg.add(pkg)
eval(Meta.parse("using $pkg")) # Load the package after installation
end
end