Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account make sure pip2 is used on systems that have pip3 as its default pip installation #404

juanrubio opened this issue Dec 3, 2017 · 2 comments


Copy link

@juanrubio juanrubio commented Dec 3, 2017

As reported by @mkg20001 in #401, on systems where pip3 is the default pip installation, Tizonia's install script should detect it and make sure a functional pip2 installation exists and is used to install Tizonia's python dependencies:

Fixed it by running sudo pip2 install --upgrade pafy
Because the setup has used python3 pip instead of python2 pip
Should be fixed in the setup scirpt
@juanrubio juanrubio added the bug label Dec 3, 2017
@juanrubio juanrubio added this to the v0.11.0 milestone Dec 3, 2017
@juanrubio juanrubio self-assigned this Dec 3, 2017
@juanrubio juanrubio changed the title make sure pip2 is used on systems that have pip3 aliased as pip make sure pip2 is used on systems that have pip3 as its default pip installation Dec 3, 2017
Copy link

@mkg20001 mkg20001 commented Dec 4, 2017

I have written a script to detect pip2

Might be useful


detectpip() {
  for p in pip pip2; do
    bin=$(which $p)
    if [ ! -z "$bin" ]; then
      bang=$(cat "$bin" | head -n 1)
      if [[ "$bang" == "#!"* ]]; then
        if [ ! -e "$py" ]; then
          echo "WARN: pip ($bin) has malformed bang!"
          v=$("$py" --version 2>&1)
          if [[ "$v" == "Python 2"* ]]; then
        echo "WARN: pip ($bin) has malformed bang!"


if [ -z "$pip" ]; then
  echo "ERROR: Python 2 pip not found. Is it installed?"
  echo "pip=$pip"

Copy link
Member Author

@juanrubio juanrubio commented Dec 5, 2017


I've been looking into this a bit and definitely your script would be the most robust method of discovering a sane pip2 installation.

However, I've noticed that on debian/raspbian systems, it is pretty safe to assume that pip2 will always point to the python 2 version. It is only when using pip when things can go wrong, as in some cases, pip could be overwritten/shadowed with the python 3 version.

Some interesting discussion about these issues here: pypa/pip#3164

So I'm thinking I will simply directly use pip2 on, since this script is only meant to be used on debian/ubuntu/raspbian distros. If the user does not have a pip2 or has it pointing to a python 3 version, then well, he/she has a bigger problem than not being able to install tizonia :-)

@juanrubio juanrubio closed this in 11e863f Dec 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants