23

I'm on a raspberry pi running the latest Debian. It comes with 2.7.3 by default but I bought it to run a large Flask home automation app which was all written on 2.7.9 and I want no problems later on ( I know it is a minor version but I am a perfectionist).

So I downloaded the latest Python 2.7.10. And did

./configure && make && make altinstall

So far so good. It has installed the interpreter under /usr/local/bin as I expected. Now I need to to be able to run pip install -r requirements.txt, then I need pip. So I downloaded the get-pip.py from the Python website and tried

/usr/local/bin/Python2.7 get-pip.py

With no luck. I have also tried to create a virtualenv with a different my compiled Python interpreter like

virtualenv -p /usr/local/Python2.7 venv

No luck either. I was able to install easy_install on my compiled Python but it also throws me an error when I try

/usr/local/bin/easy_install pip

What am I doing wrong? I have read about --ensurepip flag for configuring Python at the first place, but Do I need to remove Python and install it all over again just to have pip on my compiled interpreter?

CESCO
  • 7,305
  • 8
  • 51
  • 83
  • you forgot to sudo apt-get build-dep python2.7 before make install. – Mox Jul 07 '15 at 15:54
  • 1
    Anyway, please provide the error message too. – Mox Jul 07 '15 at 15:58
  • How would apt-get build-dep help me with if I am compiling from source? – CESCO Jul 07 '15 at 16:45
  • U will need to make sure that all the dependencies for python are properly created. Unlike installing from repo which checks all the depencies for you, installing from source means you will need to manually get the system to check the dependencies on the system so that you will not have problem running it later. – Mox Jul 07 '15 at 17:24
  • I understand it now @Mox . I am far from the environment right now; gonna test it tonight. – CESCO Jul 07 '15 at 19:25
  • sudo apt-get build-dep will only work if you have the repo for the package. if you are trying to install python3.7 the ubuntu ppa will not have dependencies for that package because it's not an available package. if you find a third-party ppa that supports a specific python version you could run such a command – cchoe1 Jun 15 '19 at 01:43

1 Answers1

49

I was facing the same issue. I resolved it by appending an extra parameter to the configure command --with-ensurepip=install followed by make and make install. Then, my installation folder for python has pip there in.

sophros
  • 14,672
  • 11
  • 46
  • 75
Pintu Kumar
  • 731
  • 8
  • 6
  • 2
    I think I'm starting to lose my mind with all these obscure configure parameters. Unfortunately this did not work for me. – jrh Nov 02 '21 at 21:42
  • After I did this, then I had to use ensurepip `python3 -m ensurepip --default-pip` – Joshua Jan 14 '22 at 22:25