salt.modules.pip

Install Python packages with pip to either the system or a virtualenv

salt.modules.pip.freeze(bin_env=None, user=None, runas=None, cwd=None)

Return a list of installed packages either globally or in the specified virtualenv

bin_env
path to pip bin or path to virtualenv. If doing an uninstall from the system python and want to use a specific pip bin (pip-2.7, pip-2.6, etc..) just specify the pip bin you want. If uninstalling from a virtualenv, just use the path to the virtualenv (/home/code/path/to/virtualenv/)
user
The user under which to run pip

Note

The runas argument is deprecated as of 0.16.2. user should be used instead.

cwd
Current working directory to run pip from

CLI Example:

salt '*' pip.freeze /home/code/path/to/virtualenv/
salt.modules.pip.install(pkgs=None, requirements=None, env=None, bin_env=None, use_wheel=False, log=None, proxy=None, timeout=None, editable=None, find_links=None, index_url=None, extra_index_url=None, no_index=False, mirrors=None, build=None, target=None, download=None, download_cache=None, source=None, upgrade=False, force_reinstall=False, ignore_installed=False, exists_action=None, no_deps=False, no_install=False, no_download=False, global_options=None, install_options=None, user=None, runas=None, no_chown=False, cwd=None, activate=False, pre_releases=False, __env__='base')

Install packages with pip

Install packages individually or from a pip requirements file. Install packages globally or to a virtualenv.

pkgs
comma separated list of packages to install
requirements
path to requirements
bin_env
path to pip bin or path to virtualenv. If doing a system install, and want to use a specific pip bin (pip-2.7, pip-2.6, etc..) just specify the pip bin you want. If installing into a virtualenv, just use the path to the virtualenv (/home/code/path/to/virtualenv/)
env
deprecated, use bin_env now
use_wheel
Prefer wheel archives (requires pip>=1.4)
log
Log file where a complete (maximum verbosity) record will be kept
proxy
Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you are behind an authenticated proxy. If you provide user@proxy.server:port then you will be prompted for a password.
timeout
Set the socket timeout (default 15 seconds)
editable
install something editable (i.e. git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed)
find_links
URL to look for packages at
index_url
Base URL of Python Package Index
extra_index_url
Extra URLs of package indexes to use in addition to index_url
no_index
Ignore package index
mirrors
Specific mirror URL(s) to query (automatically adds --use-mirrors)
build
Unpack packages into build dir
target
Install packages into target dir
download
Download packages into download instead of installing them
download_cache
Cache downloaded packages in download_cache dir
source
Check out editable packages into source dir
upgrade
Upgrade all packages to the newest available version
force_reinstall
When upgrading, reinstall all packages even if they are already up-to-date.
ignore_installed
Ignore the installed packages (reinstalling instead)
exists_action
Default action when a path already exists: (s)witch, (i)gnore, (w)wipe, (b)ackup
no_deps
Ignore package dependencies
no_install
Download and unpack all packages, but don't actually install them
no_download
Don't download any packages, just install the ones already downloaded (completes an install run with --no-install)
install_options
Extra arguments to be supplied to the setup.py install command (use like --install-option="--install- scripts=/usr/local/bin"). Use multiple --install- option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.
global_options
Extra global options to be supplied to the setup.py call before the install command.
user
The user under which to run pip

Note

The runas argument is deprecated as of 0.16.2. user should be used instead.

no_chown
When user is given, do not attempt to copy and chown a requirements file
cwd
Current working directory to run pip from
activate
Activates the virtual environment, if given via bin_env, before running install.
pre_releases
Include pre-releases in the available versions

CLI Example:

salt '*' pip.install <package name>,<package2 name>
salt '*' pip.install requirements=/path/to/requirements.txt
salt '*' pip.install <package name> bin_env=/path/to/virtualenv
salt '*' pip.install <package name> bin_env=/path/to/pip_bin

Complicated CLI example:

salt '*' pip.install markdown,django editable=git+https://github.com/worldcompany/djangoembed.git#egg=djangoembed upgrade=True no_deps=True
salt.modules.pip.list_(prefix=None, bin_env=None, user=None, runas=None, cwd=None)

Filter list of installed apps from freeze and check to see if prefix exists in the list of packages installed.

CLI Example:

salt '*' pip.list salt
salt.modules.pip.uninstall(pkgs=None, requirements=None, bin_env=None, log=None, proxy=None, timeout=None, user=None, runas=None, no_chown=False, cwd=None, __env__='base')

Uninstall packages with pip

Uninstall packages individually or from a pip requirements file. Uninstall packages globally or from a virtualenv.

pkgs
comma separated list of packages to install
requirements
path to requirements
bin_env
path to pip bin or path to virtualenv. If doing an uninstall from the system python and want to use a specific pip bin (pip-2.7, pip-2.6, etc..) just specify the pip bin you want. If uninstalling from a virtualenv, just use the path to the virtualenv (/home/code/path/to/virtualenv/)
log
Log file where a complete (maximum verbosity) record will be kept
proxy
Specify a proxy in the form user:passwd@proxy.server:port. Note that the user:password@ is optional and required only if you are behind an authenticated proxy. If you provide user@proxy.server:port then you will be prompted for a password.
timeout
Set the socket timeout (default 15 seconds)
user
The user under which to run pip

Note

The runas argument is deprecated as of 0.16.2. user should be used instead.

no_chown
When user is given, do not attempt to copy and chown a requirements file
cwd
Current working directory to run pip from

CLI Example:

salt '*' pip.uninstall <package name>,<package2 name>
salt '*' pip.uninstall requirements=/path/to/requirements.txt
salt '*' pip.uninstall <package name> bin_env=/path/to/virtualenv
salt '*' pip.uninstall <package name> bin_env=/path/to/pip_bin
salt.modules.pip.version(bin_env=None)

New in version 0.17.0.

Returns the version of pip. Use bin_env to specify the path to a virtualenv and get the version of pip in that virtualenv.

If unable to detect the pip version, returns None.

CLI Example:

salt '*' pip.version