braindump ... cause thread-dumps are not enough ;)

Do not update pip instaled from a system package!

Today I spent quite a bit of my time trying to understand why the hell am I getting weird errors when trying to work with multiple versions of python on the same debian machine. Below are my (quite emotional) notes from the process:

  • So here’s the deal: we want to use use two versions of python in parallel In normal world - not a huge deal, just install python2 and python3 packages and then python-pip and python3-pip. All cool, right? Until… you decide to set the default version to python3 and pip2 begins to die in weird circumstances. Why? What did change? “I haven’t changed anything about python2” you say. It turns out… pip2 is a script which does the following:
#!/usr/bin/python
# GENERATED BY DEBIAN

This means - it will use only the default version of python. You change to python3 to be the default - pip2 switches sides and stabs you in the back.

Solution: always use pythonX -m pip ....

  • It turns out that deb packages do not contain scripts… but they contain binaries! I’ve been replacing them with scripts through pip install --upgrade pip. Never EVER update system package though a different package manager.

Links: