Cannot `pip install` SVN dependency with authentication using SVN 1.8+
See original GitHub issueEnvironment
- pip version: 19.0.3
- Python version: 3.6.7
- OS: Ubuntu 18.04 x64 LTS
Description
Starting with SVN 1.8, SVN is non-interactive by default. Before that, it will prompt for a password when the user performs a svn checkout
.
The problem is that when pip
calls out to svn checkout
it is not interactive, and will not allow the user to enter their password. One solution is to store SVN passwords, but that may not be allowed by company rules or that may simply not be desirable for security reasons.
For some more context see
- https://github.com/gedex/wp-tools/issues/33
- https://groups.google.com/forum/#!topic/subversion_users/fQ4K5GShGPU
- https://stackoverflow.com/questions/26066979
The solution seems to be:
- If SVN version is
<1.8
, work as it does now (no extra arguments needed). - If SVN version is
>=1.8
, add the--force-interactive
command line flag.
Some context from svn checkout --help
--non-interactive : do no interactive prompting (default is to prompt
only if standard input is a terminal device)
--force-interactive : do interactive prompting even if standard input
is not a terminal device
Perhaps another solution would be to make svn
think it’s being called from a terminal device when called from pip
?
Using environment variables is another potential option, but it runs into the same fundamental issue: users have to store their password (and in this case in plaintext). This doesn’t seem to be appropriate for user workstations that could be shared.
Subversion versions on popular supported Linux distros:
- Ubuntu 18.04 LTS: 1.9.7
- Ubuntu 16.04 LTS: 1.9.3
- RHEL 7 / CentOS 7: 1.7.14
- RHEL 6 / CentOS 6: 1.6.11
Expected behavior
On SVN 1.7, 1.8, and 1.9, when pip
installs an SVN dependency, it prompts the user for their password if they have not saved it locally.
How to Reproduce
- Install Subversion >=1.8.
- If using Ubuntu 18.04,
sudo apt install subversion
.svn --version
will return1.9.7
.
- Make a
venv
:
$ python3 -m venv venv
$ source venv/bin/activate
(venv) $ pip install pip==19.0.3
- Don’t save your SVN password and try to
pip install
an SVN URL from a URL that requires authentication.pip
’s invocation ofsvn
will not prompt for a password, so it will always fail to install.
(venv) $ pip install svn+https://my-svn-server.com/project
Collecting svn+https://my-svn-server.com/project
Checking out https://my-svn-server.com/project /tmp/pip-req-build-1g_qavb
svn: E170013: Unable to connect to repository at URL 'https://https://my-svn-server.com/project'
svn: E215004: No more credentials or we tried too many times.
Authentication failed.
Command "svn checkout -q https://my-svn-server.com/project /tmp/pip-req-build-1g_qavb" failed with error code 1 in None
References
Issue Analytics
- State:
- Created 4 years ago
- Comments:35 (35 by maintainers)
Top GitHub Comments
It’s worth pointing out that ptys aren’t an option on Windows.
Also, the next release will probably happen sometime in July (every 3 months).