I would like to install the newest version of docutils
via pip
, but it can't figure out how to upgrade the system version installed via apt
.
$ sudo --set-home python2 -m pip install --upgrade docutils
Collecting docutils
Using cached https://files.pythonhosted.org/packages/3a/dc/bf2b15d1fa15a6f7a9e77a61b74ecbbae7258558fcda8ffc9a6638a6b327/docutils-0.15.2-py2-none-any.whl
Installing collected packages: docutils
Found existing installation: docutils 0.14
ERROR: Cannot uninstall 'docutils'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
$ apt-cache show python-docutils | head -n 3
Package: python-docutils
Architecture: all
Version: 0.14+dfsg-3
None of the solutions I've thought of or found on the web appeal:
Delete the
apt
version withrm -rf /usr/lib/python2.7/dist-packages/docutils*
. This silencespip
but means:- Installed files on the system no longer match what the Debian packaging system thinks
- I might break dependencies of system software on docutils 0.14
- Any updates to the Debian package will cause
apt
to reinstall - Other problems discussed in this answer
pip install --force-reinstall
. (Same problems.)pip install --ignore-install
. (Same problems.)
Is there a way to get a default environment that works for me with the newest versions of stuff from pip
but has no chance of breaking any system software? The same answer above suggests using one of virtualenv
, venv
, pyenv
, pipenv
. I tried pipenv
and it doesn't want to install individual packages listed on the commandline using --system
and I don't know whether creating a Pipfile
will actually solve this problem.
I would rather not have to manually switch environments somehow to use the apt
-installed packages versus the pip
-installed packages. Is there a way to get only apt
-installed software to use one environment and otherwise use the environment with the pip
-installed stuff?