CLI options for constructor-generated installers#

The are the command-line flags available in the installers generated by constructor.

Configure conda’s verbosity

Whether it’s while running constructor to build an installer, or while the installer is running in the target machine, some instance of conda will be running behind the scenes. You can request more verbose output via the CONDA_VERBOSITY environment variable. It can take values from 1 to 4. You can also set CONDA_DEBUG to 1.

Shell-based installers for MacOS and Linux#

We have the following CLI options available for MacOS and Linux:

  • -h (help): display the installer help message and exit.

  • -b (batch): run the installer in batch mode without user intervention.

  • -f (force): ignores existing installations and overwrites them.

  • -i (interactive): run in interactive mode (default).

  • -k (keep): do not delete the pkgs/ cache after installation.

  • -p PREFIX (path): installs to the given path.

  • -s (skip): do not run any pre/post-install scripts.

These options are available in installers that ship the conda package:

  • -t (test): can be used to run package tests after installation (it may install conda-build).

  • -u (update): try to update an existing conda installation.

Examples#

Run the installer in batch mode:

$ bash my_installer.sh -b

Run the installer in batch mode and install to a custom path:

$ bash my_installer.sh -b -p /opt/my_app

Extra verbosity

Get more verbose outputs by running the installer with -x and/or CONDA_VERBOSITY=3:

$ bash -x my_installer.sh
# or with verbose conda:
$ CONDA_VERBOSITY=3 bash -x my_installer.sh

Windows installers#

Windows installers have the following CLI options available:

  • /InstallationType=[JustMe|AllUsers]: This flag sets the installation type. The default is JustMe. AllUsers might require elevated privileges.

  • /AddToPath=[0|1]: Whether to add the installation directory to the PATH environment variable. The default is 0. This is NOT recommended.

  • /CheckPathLength=[0|1]: Check whether the installation path is too long (>46 characters). The default depends on how the installer was created.

  • /KeepPkgCache=[0|1]: Whether to keep the package cache or not. Defaults to 1.

  • /NoRegistry=[0|1]: Whether to prevent registry modification or not. Defaults to 0.

  • /NoScripts=[0|1]: If set to 1, the installer will not run any post-install scripts. Defaults to 0.

  • /NoShortcuts=[0|1]: If set to 1, the installer will not create any shortcuts. Defaults to 0.

  • /RegisterPython=[0|1]: Whether to register Python as default in the Windows registry. Defaults to 1. This is preferred to AddToPath.

You can also supply standard NSIS flags, but only after the ones mentioned above:

  • /NCRC: disables the CRC check.

  • /S (silent): runs the installer or uninstaller in silent mode.

  • /D (directory): sets the default installation directory. Note that even if the path contains spaces, it must be the last parameter used in the command line and must not contain any quotes. Only absolute paths are supported. The uninstaller uses _? instead of /D.

Examples:#

Note that the NSIS installers will not write any output to the terminal. You will not see any output, even if the installation fails. You can check the Task Manager to see if the installer is running, or poll the installation directory to see if the installation has finished.

Run the installer in silent mode:

> cmd.exe /c start /wait my_installer.exe /S

Run the installer in silent mode and install to a custom path:

> cmd.exe /c start /wait my_installer.exe /InstallationType=AllUsers /AddToPath=1 /S /D=C:\Program Files\my_app

Run the uninstaller in silent mode from its original location:

> cmd.exe /c start /wait "C:\Program Files\my_app\uninstaller.exe" /S _?=C:\Program Files\my_app

EXE installers with file logging

Windows installers do not have a verbose mode. By default, the graphical logs are only available in the “progress bar” dialog, by clicking on “Show details”. This text box is right-clickable, which will allow you to copy the contents to the clipboard (and then paste them in a text file, presumably).

There’s a way of building EXE installers that can write logs to a file; for this, you need a special nsis package configured to do so:

> conda install "nsis=*=*log*"

Then, you can invoke constructor normally after setting a special environment variable:

> set "NSIS_USING_LOG_BUILD=1"
> constructor .

The resulting EXE installer will always generate an install.log file in the target directory. It will contain the full logs, as available in the “Show details” dialog.

Combine this with CONDA_VERBOSITY=3 at install time for maximum details:

> set "CONDA_VERBOSITY=3"
> cmd.exe /c start /wait your-installer.exe

PKG installers#

The PKG installers do not offer any CLI options. Instead, you need to use the installer subcommand:

$ installer -pkg my_installer.pkg -dumplog -target CurrentUserHomeDirectory
# with extra verbosity from conda
$ CONDA_VERBOSITY=3 installer -pkg my_installer.pkg -dumplog -target CurrentUserHomeDirectory

Note you can’t choose a custom path for the installation. Instead, you can only choose a target. Refer to man installer for more information.