Octave for Microsoft Windows: Difference between revisions

→‎Octave Packages: corrected information about update -global
m (→‎Package Installation and Update: add note about write access requirement)
(→‎Octave Packages: corrected information about update -global)
Line 22: Line 22:


==Octave Packages==
==Octave Packages==
Like many software programs, Octave uses ''packages'' to optionally extend and modify its capability without changing core Octave behavior. These packages can be installed and loaded using the built in package management program 'pkg'.  (Note that Octave does not automatically load installed packages, they must be manually loaded from within Octave by the user.)  
Like many software programs, Octave uses ''packages'' to optionally extend and modify its capability. These packages can be installed and loaded using the built in package management program 'pkg'.  (Note that Octave does not automatically load installed packages, they must be manually loaded from within Octave by the user.)  


Octave maintains a system-wide (or ''global'') package list, and a user-specific (or ''local'') package list. By default in Windows 10, local packages are located at {{Path|C:\Users\%USERNAME%\octave\}}.  (The \octave folder will be created during the first package install if it is not already present.)  The global packages are stored in {{Path|%OCTAVE_HOME%\mingw64\share\octave\packages\}}. Specific locations on your system can be found by typing the following commands at the Octave command line:
Octave maintains a system-wide (or ''global'') package list, and a user-specific (or ''local'') package list. By default in Windows 10, local packages are located at {{Path|C:\Users\%USERNAME%\octave\}}.  (The \octave folder will be created during the first package install\update if it is not already present.)  The global packages are stored in {{Path|%OCTAVE_HOME%\mingw64\share\octave\packages\}}, and are available to all users on the machine. Specific locations on your system can be found by typing the following commands at the Octave command line:


     >> pkg local_list
     >> pkg local_list
     >> pkg global_list
     >> pkg global_list


Octave versions for Windows prior to 6.1.0 defaulted to always using and making changes to global packages.  The default is now to follow the same behavior on all platforms, and for all package updates and installations to apply to the user's local package list in the user's home folder unless otherwise specified.
Octave versions for Windows prior to 6.1.0 defaulted to always using and making changes to global packages.  The default is now to follow the same behavior on all platforms, and for all package updates and installations to apply to local or global package locations according to whether or not the user is running with Administrative privileges (on Windows, this is usually accomplished by running as an Administrator privileged account, or running Octave with the "Run as Administrator" option).  Alternatively, some pkg command options can force octave to try to use either the local or global packages.


===Pre-installed Packages===
===Pre-installed Packages===
Line 37: Line 37:
   >> pkg list
   >> pkg list


The output for preinstalled global packages included with version 6.1.0 installed into {{Path|C:\Octave}} is:
The output for preinstalled global packages included with version 6.1.0 when installed into {{Path|C:\Octave}} is:
                                                                                              
                                                                                              
     Package Name        | Version | Installation directory
     Package Name        | Version | Installation directory
Line 89: Line 89:
                 zeromq  |  1.5.2 | C:\Octave\octave-6.1.0-w64\mingw64\share\octave\packages\zeromq-1.5.2
                 zeromq  |  1.5.2 | C:\Octave\octave-6.1.0-w64\mingw64\share\octave\packages\zeromq-1.5.2


Note that the included packages shown above are stored in the default ''global package location''.
Note that the included packages shown above are stored in the default ''global package location'' within the Octave installation folder.


If Octave was installed from a zip or 7z archive and you did not run the {{Path|post-install.bat}} file, you may not see any packages listed.  In that case you need to run:
If Octave was installed from a zip or 7z archive and you did not run the {{Path|post-install.bat}} file, you may not see any packages listed.  In that case you need to run:
Line 95: Line 95:
   >> pkg rebuild
   >> pkg rebuild


That will force octave to look for both ''local'' and ''global'' packages in the set locations to repopulate list of available packages.  Note that  'local' packages take precedence if present in both locations.  
That will force octave to look for both ''local'' and ''global'' packages in the set locations to repopulate the list of available packages.  Note that  'local' packages always take precedence if the same package is present in both locations.  


===Package Installation and Update===
===Package Installation and Update===
Line 111: Line 111:
   >> pkg install package_file_name.tar.gz
   >> pkg install package_file_name.tar.gz


Note that all of the commands above will perform ''local'' package installs.  E.g., if an update is found for a global package, the updated version will be installed to the ''local'' package location, leaving the old version intact in the ''global'' package location.  This behavior can be changed by calling the install command with the {{Path|-global}} option. For example:
Note that all of the commands above will perform ''local'' or ''global'' package installs according to the user's Administrator access level.  E.g., if an update is found for a global package with a non-elevated user, the updated version will be installed to the ''local'' package location, leaving the old version intact in the ''global'' package location.  This behavior can be changed by calling the install command with the {{Path|-global}} option. For example:


To update all global packages to the latest version (requires write-access to the global-list location) you can use:
To install a global package to the latest version (requires write-access to the global-list location) you can use:


   >> pkg update -global
   >> pkg install -forge -global <package_name>


or for one specific package:
Note that the update command does not take -local or -global options, and always performs an update according to the user's Administrator access level.
 
  >> pkg install -forge -global <package_name>


Detailed instructions for installing individual Octave Forge packages are given at https://octave.sourceforge.io/packages.php.
Detailed instructions for installing individual Octave Forge packages are given at https://octave.sourceforge.io/packages.php.
150

edits