File size: 686 Bytes
e9b2ee8
58cb6bc
e9b2ee8
 
 
b796812
e9b2ee8
 
 
 
 
 
 
 
 
1413838
 
e9b2ee8
 
 
 
 
 
 
 
1413838
 
e9b2ee8
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
"""This file installs and loads extensions for SymbolicRegression."""

from .julia_import import jl


def load_required_packages(*, turbo=False, enable_autodiff=False, cluster_manager=None):
    if turbo:
        load_package("LoopVectorization")
    if enable_autodiff:
        load_package("Zygote")
    if cluster_manager is not None:
        load_package("ClusterManagers")


def load_package(package_name):
    jl.seval(
        f"""
        try
            using {package_name}
        catch e
            isa(e, ArgumentError) || throw(e)
            using Pkg: Pkg
            Pkg.add("{package_name}")
            using {package_name}
        end
    """
    )
    return None