python pip silent install

28,852

Solution 1

If the answer is always y:

yes | pip install <package>

Solution 2

A silent install is possible by using the quiet flag:

pip install somepackage --quiet

This hides installation messages.

Additionally, you may want to force "always yes" as per this answer, and/or an exists-action option for a default behaviour when multiple choices exist:

yes | pip install somepackage --quiet --exists-action ignore

This truly has its mouth shut!

Solution 3

Adding an answer, since things have changes since 2011...

Pip version 1.1 release on 2012-02-16 has introduced a command line switch --exists-action <action> which allows to specify the default behavior from (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.

According to the current documentation pip can only prompt for information if --exists-action is unspecified.

Share:
28,852

Related videos on Youtube

jsuereth
Author by

jsuereth

Updated on March 23, 2022

Comments

  • jsuereth
    jsuereth about 1 year

    Is there a way to do a silent install with pip?

    For some more background I'm using fabric to do server deployments and I want to be able to setup a new server or update an existing one without any interaction and some of the packages require a y/n response.

  • Andy Baker
    Andy Baker over 8 years
    Unfortunately the main blocker for an unattended run I've found is this question: "What to do? (s)witch, (i)gnore, (w)ipe, (b)ackup"
  • Etienne Prothon
    Etienne Prothon over 7 years
    Is there an equivalent in windows cmd ?
  • bufh
    bufh almost 7 years
    Note that it does not work in some scenarios, such as a SSH prompt (ie: The authenticity of host 'example.net (192.0.2.1)' can't be established. ... Are you sure you want to continue connecting (yes/no)?), at least in pip 1.5.4.
  • JeffHeaton
    JeffHeaton almost 4 years
    Also only works in *NIX. Its too bad pip does not have a built in (therefore cross platform) means of doing this.