What do (s)witch, (i)gnore, (w)ipe, (b)ackup options mean when installing a package from repository using pip?
Question:
When installing a package using pip, I get the following message:
Obtaining some-package from git+git://github.com/some-user/some-package.git@commit-hash#egg=some_package-dev (from -r requirements.txt
(line 3))
git clone in /Users/me/Development/some-env/src/some-package exists with
URL https://github.com/some-user/some-package.git
The plan is to install the git repository git://github.com/some-user/some-package.git
What to do? (s)witch, (i)gnore, (w)ipe, (b)ackup
I see that this particular case is probably caused by a change of protocol in URL (new requirement uses git://
, while the one already installed uses https://
).
However, I wonder what exactly happens if I choose either of the choices (switch, ignore, wipe, backup). I’m unable to find an explanation in pip documentation.
Answers:
A patch explaining this option was merged into the PIP documentation, but it was not released until Pip 6.0 (2014-12-22). (https://github.com/pypa/pip/commit/b5e54fc61c06268c131f1fad3bb4471e8c37bb25). Here is what that patch says:
–exists-action option
This option specifies default behavior when path already exists.
Possible cases: downloading files or checking out repositories for installation,
creating archives. If --exists-action
is not defined, pip will prompt
when decision is needed.
-
(s)witch
Only relevant to VCS checkout. Attempt to switch the checkout
to the appropriate url and/or revision.
-
(i)gnore
Abort current operation (e.g. don’t copy file, don’t create archive,
don’t modify a checkout).
-
(w)ipe
Delete the file or VCS checkout before trying to create, download, or checkout a new one.
-
(b)ackup
Rename the file or checkout to {name}{'.bak' * n}
, where n is some number
of .bak
extensions, such that the file didn’t exist at some point.
So the most recent backup will be the one with the largest number after .bak
.
And here is a link to description of that option in the now-updated documentation: https://pip.pypa.io/en/stable/cli/pip/#exists-action-option.
When installing a package using pip, I get the following message:
Obtaining some-package from git+git://github.com/some-user/some-package.git@commit-hash#egg=some_package-dev (from -r requirements.txt
(line 3))
git clone in /Users/me/Development/some-env/src/some-package exists with
URL https://github.com/some-user/some-package.git
The plan is to install the git repository git://github.com/some-user/some-package.git
What to do? (s)witch, (i)gnore, (w)ipe, (b)ackup
I see that this particular case is probably caused by a change of protocol in URL (new requirement uses git://
, while the one already installed uses https://
).
However, I wonder what exactly happens if I choose either of the choices (switch, ignore, wipe, backup). I’m unable to find an explanation in pip documentation.
A patch explaining this option was merged into the PIP documentation, but it was not released until Pip 6.0 (2014-12-22). (https://github.com/pypa/pip/commit/b5e54fc61c06268c131f1fad3bb4471e8c37bb25). Here is what that patch says:
–exists-action option
This option specifies default behavior when path already exists.
Possible cases: downloading files or checking out repositories for installation,
creating archives. If--exists-action
is not defined, pip will prompt
when decision is needed.
(s)witch
Only relevant to VCS checkout. Attempt to switch the checkout
to the appropriate url and/or revision.(i)gnore
Abort current operation (e.g. don’t copy file, don’t create archive,
don’t modify a checkout).(w)ipe
Delete the file or VCS checkout before trying to create, download, or checkout a new one.
(b)ackup
Rename the file or checkout to
{name}{'.bak' * n}
, where n is some number
of.bak
extensions, such that the file didn’t exist at some point.
So the most recent backup will be the one with the largest number after.bak
.
And here is a link to description of that option in the now-updated documentation: https://pip.pypa.io/en/stable/cli/pip/#exists-action-option.