Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python pip silent install

Tags:

python

pip

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.

like image 837
wegrata Avatar asked Dec 06 '11 13:12

wegrata


3 Answers

If the answer is always y:

yes | pip install <package>
like image 113
Fred Foo Avatar answered Nov 08 '22 18:11

Fred Foo


A silent install is possible by using the quiet flag:

pip install somepackage --quiet

This hides installation messages.
As per its documentation, note that this option is additive, and can be specified up to 3 times to remove messages of increasing levels of importance (warning, error, critical).

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!

like image 33
alelom Avatar answered Nov 08 '22 20:11

alelom


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.

like image 5
bluenote10 Avatar answered Nov 08 '22 20:11

bluenote10