update all python packages on Debian/Ubuntu

Jabba Laci jabba.laci at gmail.com
Tue Sep 13 06:33:22 CEST 2011


I use Ubuntu and the Python packages on my system were either
installed with (1) apt-get, or with (2) pip. Since the number of
python packages in the Ubuntu repositories is limited, I had to
install several packages with pip.

Now I want to upgrade the packages that were installed with pip (and
only those packages).

I can collect the list of python packages:
(pip freeze | cut -d = -f 1 | grep -v FIXME | xargs echo | tr ' ' '\n'
>list.txt) 2>/dev/null

However, if I update every package in list.txt with "pip install -U",
it will also update the ones that were installed with apt-get. Since
apt-get builds a database with the installed files, I'm sure it won't
like that pip replaces those files. I didn't try it yet but I'm afraid
it would mess up the system.

So, how to upgrade the python packages correctly?



More information about the Python-list mailing list