Main Content

mpminstall

Install package

Since R2024b

    Description

    pkg = mpminstall(packageFolder) installs the specified package folder and its dependencies, adds them to the path, and returns a matlab.mpm.Package object. MATLAB® searches all folders on the MATLAB path and installs the latest version.

    example

    pkg = mpminstall(packageSpecifier) installs the specified package and it's dependencies and adds them to the path. By default, the function searches all known repositories and installs the latest version.

    example

    pkg = mpminstall(pkgArray) installs the specified packages and their dependencies. The function copies packages and their dependencies to the default installation area. All packages specified in the argument list are added to the MATLAB path.

    pkg = mpminstall(___,Name=Value) specifies options using one or more name-value arguments. For example, you can specify whether to install package dependencies and whether to add the package member folders to the beginning or end of the MATLAB path.

    example

    Examples

    collapse all

    Install the package MyPackage. When prompted, confirm the installation.

    pkg = mpminstall("MyPackage")
    The following packages will be installed:
        MyPackage@1.0.0
    
    Do you want to continue? [YES/no]:
    
    
    Copying MyPackage@1.0.0 package...Done.
    
    Successfully added the following packages to the path:
        MyPackage  (help)
    
    Installation complete.
    
    
    pkg = 
    
      Package with properties:
    
       Package Definition
                         Name: "MyPackage"
                  DisplayName: "MyPackage"
                      Version: 1.0.0 (1×1 Version)
                      Summary: ""
                  Description: ""
                     Provider: <missing>
                      Folders: [1×0 PackageFolder] (1×0 PackageFolder)
                 Dependencies: ""
         ReleaseCompatibility: "*"
                  FormerNames: ""
                           ID: "bb9abc84-5324-42fd-851c-b65e2887f3b5"
    
       Package Installation
                    Installed: 1
                     Editable: 0
        InstalledAsDependency: 0
                  PackageRoot: "C:\Users\MyProfile\AppData\Roaming\MathWorks\MATLAB Add-Ons\MyPackage@1.0.0"
        InstalledDependencies: ""
          MissingDependencies: ""
    
       Repository
                   Repository: [0×0 Repository]
    
      help MyPackage

    Install the package MyPackage by specifying the root folder. When prompted, confirm the installation.

    pkg = mpminstall("C:\MyCode\PackageRootDir")
    The following packages will be installed:
        MyPackage@1.0.0
    
    Do you want to continue? [YES/no]:
    
    
    Copying MyPackage@1.0.0 package...Done.
    
    Successfully added the following packages to the path:
        MyPackage  (help)
    
    Installation complete.
    
    
    pkg = 
    
      Package with properties:
    
       Package Definition
                         Name: "MyPackage"
                  DisplayName: "MyPackage"
                      Version: 1.0.0 (1×1 Version)
                      Summary: ""
                  Description: ""
                     Provider: <missing>
                      Folders: [1×0 PackageFolder] (1×0 PackageFolder)
                 Dependencies: ""
         ReleaseCompatibility: "*"
                  FormerNames: ""
                           ID: "bb9abc84-5324-42fd-851c-b65e2887f3b5"
    
       Package Installation
                    Installed: 1
                     Editable: 0
        InstalledAsDependency: 0
                  PackageRoot: "C:\Users\MyProfile\AppData\Roaming\MathWorks\MATLAB Add-Ons\MyPackage@1.0.0"
        InstalledDependencies: ""
          MissingDependencies: ""
    
       Repository
                   Repository: [0×0 Repository]
    
      help MyPackage

    Install the package MyPackage in authoring mode by specifying the root folder and the Authoring name-value argument. In authoring mode, the mpminstall function installs the package in its current location rather than in the default installation area and makes the package editable. When prompted, confirm the installation.

    pkg = mpminstall("C:\MyCode\PackageRootDir",Authoring=true)
    The following packages will be installed:
        MyPackage@1.0.0
    
    Do you want to continue? [YES/no]:
    
    
    Copying MyPackage@1.0.0 package...Done.
    
    Successfully added the following packages to the path:
        MyPackage  (help)
    
    Installation complete.
    
    
    pkg = 
    
      Package with properties:
    
       Package Definition
                         Name: "MyPackage"
                  DisplayName: "MyPackage"
                      Version: 1.0.0 (1×1 Version)
                      Summary: ""
                  Description: ""
                     Provider: <missing>
                      Folders: [1×0 PackageFolder] (1×0 PackageFolder)
                 Dependencies: ""
         ReleaseCompatibility: "*"
                  FormerNames: ""
                           ID: "bb9abc84-5324-42fd-851c-b65e2887f3b5"
    
       Package Installation
                    Installed: 1
                     Editable: 1
        InstalledAsDependency: 0
                  PackageRoot: "C:\MyCode\PackageRootDir"
        InstalledDependencies: ""
          MissingDependencies: ""
    
       Repository
                   Repository: [0×0 Repository]
    
      help MyPackage

    Input Arguments

    collapse all

    MATLAB package folder, specified as a string array where each element contains a package root folder.

    Example: “MyFolder\packageSource”

    MATLAB package specifier, specified as a string array where each element contains a package specifier or a matlab.mpm.PackageSpecifier object. A valid folder matching the input takes precedence over a valid package specifier.

    Example: “packageSpecifier”

    Example: “packageSpecifier@1.0.0”

    Example: "Pkg@1.0.1@17487be8-15e8-447b-9319-83516fc31f08"

    MATLAB package, specified as a matlab.mpm.Package object array.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: pkg = mpminstall(pkgArray,Prompt=true)

    Display installation prompts, specified as a numeric or logical 1 (true) or 0 (false). If you specify Prompt as false, then installation prompts are not displayed and the function automatically confirms that packages should be installed when prompted.

    Example: Prompt=false

    Verbosity level for displayed information, specified as one of these values:

    • "normal" (default) — Display informational messages during installation.

    • "quiet" — Do not display informational messages.

    • "detailed" — Display additional informational messages.

    Example: Verbosity="quiet"

    Install dependencies, specified as a numeric or logical 1 (true) or 0 (false). If you specify InstallDependencies as false, then the function does not install package dependencies.

    Example: InstallDependencies=false

    Force installation, specified as a numeric or logical 1 (true) or 0 (false). If you specify Force as true, then the function installs packages even if a dependency is not found or if the MATLAB version is not compatible with the ReleaseCompatibility property of the installed package.

    Example: Force=true

    Allow replacement of installed version, specified as a numeric or logical 1 (true) or 0 (false). If you specify AllowVersionReplacement as true, then the function can replace any previously installed version of a package with the specified version so that only one version of the package is installed. If false, then an error is thrown when the package to be installed matches an already installed package.

    Example: AllowVersionReplacement=true

    Install in place, specified as a numeric or logical 1 (true) or 0 (false). If you specify InPlace as true, then the function installs the package in its current location rather than copying it to the default installation area.

    Inputs must be root folders when InPlace is true.

    Example: InPlace=true

    Enable editable mode, specified as a numeric or logical 1 (true) or 0 (false). If you specify Editable as true, then the function installs the package in editable mode and MATLAB will recognize changes to the package definition file and member folders. InPlace must also be true.

    The package to be installed must be specified as a package root folder or as a matlab.mpm.Package object created from a package root folder when Editable is true.

    Example: Editable=true

    Temporary install, specified as a numeric or logical 1 (true) or 0 (false). If you specify Temporary as true, then the function installs the package only for the current MATLAB session.

    Example: Temporary=true

    Position on the MATLAB path, specified as "end" or "beginning". This value determines if package member folders are added to the end or beginning of the MATLAB path, respectively.

    Example: PathPosition="beginning"

    Enable authoring mode, specified as a numeric or logical 1 (true) or 0 (false). If you specify Authoring as true, then Editable and InPlace are automatically set to true and PathPosition is automatically set to "beginning".

    pkgArray must be a root folder when Authoring is true.

    Example: Authoring=true

    Algorithms

    collapse all

    Version History

    Introduced in R2024b