Octave for Microsoft Windows: Difference between revisions

From Octave
Jump to navigation Jump to search
(updated details for Octave 7.1.0)
(→‎Installers for Microsoft Windows: added note about blas_switch.exe)
Line 18: Line 18:
# If a command-line only instance of Octave is desired, the user can create another shortcut as stated above, right-click on the shortcut, select Properties, and add <code>--no-gui</code> to the end of the Target field.
# If a command-line only instance of Octave is desired, the user can create another shortcut as stated above, right-click on the shortcut, select Properties, and add <code>--no-gui</code> to the end of the Target field.
# IMPORTANT: Run the {{Path|post-install.bat}} file before running Octave the first time to reduce plot delays due to the Windows font cache and make the pre-installed packages visible to the system.
# IMPORTANT: Run the {{Path|post-install.bat}} file before running Octave the first time to reduce plot delays due to the Windows font cache and make the pre-installed packages visible to the system.
# The exe installer prompts you to choose which Basic Linear Algebra Subprograms (BLAS) library to use, and creates a shortcut to a BLAS switcher program. The 7z/zip archives default to using [https://netlib.org/blas Reference BLAS].  [https://www.openblas.net OpenBLAS] is also available, and may be preferable for certain users. 7z/zip archive users wanting to change their BLAS library can manually run the switcher program located at {{Path|/mingw64/bin/blas_switch.exe}}.


* Note: versions before 7.1.0 used .vbs and .bat files to start Octave.  The {{Path|octave.bat}} file is still available in {{Path|\mingw32\bin}} or {{Path|\mingw64\bin}}, depending on the version of Octave installed, for use cases requiring it for startup.  
* Note: versions before 7.1.0 used .vbs and .bat files to start Octave.  The {{Path|octave.bat}} file is still available in {{Path|\mingw32\bin}} or {{Path|\mingw64\bin}}, depending on the version of Octave installed, for use cases requiring it for startup.  
Line 123: Line 124:


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.


=GNU Octave in MSYS2=
=GNU Octave in MSYS2=

Revision as of 17:53, 8 September 2022

This article is about using pre-built installers of Octave for Windows; for instructions about building it, see Windows Installer.
Info icon.svg
Windows installers are available for the latest version of Octave (9.3.0, released on December 12, 2024) from https://ftpmirror.gnu.org/gnu/octave/windows/.

Users are encouraged to use the latest version unless a specific feature or requirement warrants using an older version of the software. Version specific instructions and installation notes are provided below.

Note: As of version 4.4.1, Octave no longer supports Windows XP. There may be some workarounds to get Octave installed and running in command line mode (see Bug #54662), but maintainers cannot provide support and troubleshooting for this beyond what has already been documented.

Installers for Microsoft Windows

The easiest way to install GNU Octave on Microsoft Windows is by using MXE builds. For the current release, both 32-bit and 64-bit installers and zip archived packages (.zip and .7z formats) can be found at https://www.gnu.org/software/octave/download.html under the Windows tab.

  • For executable (.exe) installers: the user can simply run the downloaded file and follow the on-screen installation prompts. It is recommended that the installation path does not include spaces or non-ASCII characters. Shortcuts to the program will be created automatically.
  • For the 7z/zip archives:
  1. Extract the file content to a directory on the harddrive (such as C:\Octave). Spaces or non-ASCII characters in the path are discouraged and may cause program errors.
  2. Manually create a shortcut to the octave-launch.exe file in the main installation directory. (Right-click on the file, select 'Create Shortcut', and move the new shortcut to your desired location.)
  3. If a command-line only instance of Octave is desired, the user can create another shortcut as stated above, right-click on the shortcut, select Properties, and add --no-gui to the end of the Target field.
  4. IMPORTANT: Run the post-install.bat file before running Octave the first time to reduce plot delays due to the Windows font cache and make the pre-installed packages visible to the system.
  5. The exe installer prompts you to choose which Basic Linear Algebra Subprograms (BLAS) library to use, and creates a shortcut to a BLAS switcher program. The 7z/zip archives default to using Reference BLAS. OpenBLAS is also available, and may be preferable for certain users. 7z/zip archive users wanting to change their BLAS library can manually run the switcher program located at /mingw64/bin/blas_switch.exe.
  • Note: versions before 7.1.0 used .vbs and .bat files to start Octave. The octave.bat file is still available in \mingw32\bin or \mingw64\bin, depending on the version of Octave installed, for use cases requiring it for startup.

Octave Packages

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 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 %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 global_list

Octave versions for Windows prior to 6.1.0 defaulted to always making changes to global packages unless the user specified otherwise. 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 starting 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

A selection of pre-built, Octave Forge packages is included with all versions of the official Windows release. If you followed the installation directions above, you can display a list of packages by typing the command below at the Octave command prompt:

  >> pkg list

The output for preinstalled global packages included with version 7.1.0 when installed into C:\Octave is:

   Package Name         | Version | Installation directory
   ---------------------+---------+-----------------------
                 audio  |   2.0.4 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\audio-2.0.4
                biosig  |   2.4.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\audio-2.4.0
        communications  |   1.2.4 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\communications-1.2.4
               control  |   3.4.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\control-3.4.0
        data-smoothing  |   1.3.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\data-smoothing-1.3.0
              database  |   2.4.4 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\database-2.4.4
             dataframe  |   1.2.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\dataframe-1.2.0
                 dicom  |   0.4.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\dicom-0.4.1
             financial  |   0.5.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\financial-0.5.3
                  fits  |   1.0.7 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\fits-1.0.7
   fuzzy-logic-toolkit  |   0.4.6 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\fuzzy-logic-toolkit-0.4.6
                    ga  |  0.10.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\ga-0.10.3
               general  |   2.1.2 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\general-2.1.2
         generate_html  |   0.3.2 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\generate_html-0.3.2
              geometry  |   4.0.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\geometry-4.0.0
                   gsl  |   2.1.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\gsl-2.1.1
                 image  |  2.14.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\image-2.14.0
    instrument-control  |   0.7.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\instrument-control-0.7.1
              interval  |   3.2.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\interval-3.2.1
                    io  |   2.6.4 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\io-2.6.4
        linear-algebra  |   2.2.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\linear-algebra-2.2.3
                  lssa  |   0.1.4 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\lssa-0.1.4
                 ltfat  |   2.3.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\ltfat-2.3.1
               mapping  |   1.4.2 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\mapping-1.4.2
               matgeom  |   1.2.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\matgeom-1.2.3
         miscellaneous  |   1.3.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\miscellaneous-1.3.0
                   nan  |   3.6.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\nan-3.6.1
                netcdf  |  1.0.14 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\netcdf-1.0.14
                 nurbs  |   1.4.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\nurbs-1.4.3
                   ocs  |   0.1.5 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\ocs-0.1.5
               octproj  |   2.0.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\octproj-2.0.1
                 optim  |   1.6.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\optim-1.6.1
           optiminterp  |   0.3.7 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\optiminterp-0.3.7
            quaternion  |   2.4.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\quaternion-2.4.0
              queueing  |   1.2.7 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\queueing-1.2.7
                signal  |   1.4.1 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\signal-1.4.1
               sockets  |   1.3.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\sockets-1.3.0
             sparsersb  |   1.0.9 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\sparsersb-1.0.9
               splines  |   1.3.4 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\splines-1.3.4
            statistics  |   1.4.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\statistics-1.4.3
                   stk  |   2.7.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\stk-2.7.0
               strings  |   1.2.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\strings-1.2.0
                struct  |  1.0.17 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\struct-1.0.17
              symbolic  |   2.9.0 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\symbolic-2.9.0
                tisean  |   0.2.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\tisean-0.2.3
                   tsa  |   4.6.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\tsa-4.6.3
                 video  |   2.0.2 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\video-2.0.2
               windows  |   1.6.2 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\windows-1.6.2
                zeromq  |   1.5.3 | C:\Octave\octave-7.1.0-w64\mingw64\share\octave\packages\zeromq-1.5.3
                                                                                          

Note that the included packages shown above are stored in the default global package location within the Octave installation folder. If any 'local' packages were previously installed with another version of windows, they might also appear in the list at the local location. It is recommended that any such packages be uninstalled and reinstalled to guarantee compatibility with the current version of octave.

If Octave was installed from a zip or 7z archive and you did not run the post-install.bat file, you may not see any packages listed. In that case you need to run:

  >> pkg rebuild

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.

Note: The Windows bundle includes a minimal version of Python for the symbolic package. That version of Python is not intended to be used for anything else. If you like to use Python for something different in Octave (e.g., for the pythonic package), install a full Python distribution and set the necessary environment variables (PYTHON, ...?).

Package Installation and Update

All packages can be updated to the latest version by running:

  >> pkg update

Other packages can be installed by running:

  >> pkg install -forge <package_name>

To install a new or updated package version manually, the package file can be downloaded from the Octave Forge website to the working directory and can be installed using:

  >> pkg install package_file_name.tar.gz

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 account, 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 -global option. As of Octave 7.1.0 the -global option also works with the pkg update command. For example:

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

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

GNU Octave in MSYS2

MSYS2 is a collection of tools and libraries providing an easy-to-use environment for building, installing and running native Windows software. GNU Octave is available as a package in MSYS2.

The best (and recommended) way to use Octave on Windows is to use the provided installers (see above). But for some special requirements, the version of Octave packaged by MSYS2 might be the better solution. Those special requirements might include:

  • Users might want to use e.g. Octave packages that depend on third party packages not included in MXE Octave.
  • Users might need features of newer versions of packages that are included in an older version in MXE Octave.
  • ...

MSYS2 follows a rolling release cycle. So, its packages are most likely more up-to-date than the packages included in Octave's installer for Windows. It includes a (working) package manager (pacman) that provides the option to install a much wider range of packages than what can possibly be included in Octave's installer for Windows.

To use Octave in MSYS2, install the MSYS2 environment following their instructions. At the bash shell (use e.g. "MSYS2 MinGW 64-bit" from the start menu), update the installation by pacman -Syu. After that, install a version of Octave that matches your environment (and the shell you are using), e.g. pacman -S mingw-w64-x86_64-octave.

This will install (among others), the main executables of Octave octave-gui (linked with Qt, i.e., including the "qt" graphics toolkit and the GUI), octave-cli (linked without Qt, i.e., only "fltk" and "gnuplot" graphics toolkits and no GUI), and the wrapper executable octave that dispatches to one of the former executables depending on the used command line switches. The Octave GUI can be started with octave --gui from MSYS2's bash shell, the command line interface (CLI) with octave.

GNU Octave on cygwin

  • Maintainer: Marco Atzeri
  • Latest release: 2022-01-06
  • Latest packages:
octave-6.4.0-1
Its announce on cygwin mailing list [1]
Octave Forge packages have each a cygwin package.
Its announce on cygwin mailing list [2]
Full cygwin package list is available here [3]
At 2017-04-06, 64 forge packages were available.
  • To install :
run setup-x86_64.exe (for cygwin 64 bit) and select them in the Math category.
All the package dependencies will be also installed.
Graphics is based on X and to plot you will need to start octave within xterm (or similar).
I recommend to install "xinit", "xlaunch" and "gnuplot". These packages will pull all the functional Xserver.
Otherwise the only graphics will be ASCII art ;-)

Notes for cygwin

  • To build GNU Octave from cygwin source package, you need to install "cygport" and the relevant development libraries
tar -xf octave-6.4.0-1-src.tar.xz 
cygport octave.cygport almostall
see cygport documentation at /usr/share/doc/cygport/html/manual/toc_index.html for further info.

General info

Be advised that GNU Octave is primarily developed on GNU/Linux and other POSIX conform systems. The ports of GNU Octave to Microsoft Windows use different approaches to get most of the original Octave and adapt it to Microsoft Windows idiosyncrasies (e.g. dynamic libraries, file paths, permissions, environment variables, GUI system, etc). Bear this in mind and don't panic if you get unexpected results. There are a lot of suggestions on the mailing lists for tuning your Octave installation. GNU Octave standalone ports for Windows are independently compiled using either the MinGW or Microsoft Visual Studio development environments (3.6 or before).

See also