how to install pip for python2.7

21,528 views
Skip to first unread message

Rafał Szymański

unread,
Jul 24, 2014, 7:33:54 AM7/24/14
to obey-the-test...@googlegroups.com
Hi there!
I'd like to install fabric.
pip install fabric is installing it for python3.4. I have python2.7 but don't have pip for this version. I was trying to find some explenation how to do that but ech of them are more complicated. Could anyone tell me hot to install pip for python 2.7 in a step-by-step way, please?

Jonathan Hartley

unread,
Jul 24, 2014, 9:57:18 AM7/24/14
to obey-the-test...@googlegroups.com
One way to do it looks like this:

Quick sanity-check that you can run Python 2.7 when you want to:

$ python2.7 --version
Python 2.7.3

and as root, too, because we will be installing setuptools system-wide:

$ sudo python2.7 --version
Python 2.7.3

I install pip using easy_install, so we need easy_install for python2.7. Download setuptools' installer and run it with Python2.7:

$ wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python2.7

Now you should have 'easy_install-2.7' on your path. Use it to install pip:

$ sudo easy_install-2.7 pip

Now you should have 'pip2.7' on your path, which you can use to install to Python2.7

$ pip2.7 install Django # or whatever

I'm assuming you are on a Unix. For OSX & Windows there may be differences, but the overall approach should still be OK.

    Jonathan
-- 
Jonathan Hartley    tar...@tartley.com    http://tartley.com
Made of meat.       +44 7737 062 225       twitter/skype: tartley

Rafał Szymański

unread,
Jul 25, 2014, 3:46:27 AM7/25/14
to obey-the-test...@googlegroups.com
Thank You so much Jonathan for your time and willingnes to help me.
Unfortunately I'm using Windows. Not for long but still for a while.
There is no wget on windows but I found how to download file You point me.
Then everything went well but when I typed pip2 install fabric I received this nice thing:
Traceback (most recent call last):
  File "C:\Python27\Scripts\pip2-script.py", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip2')()
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\__init__.py", line
 185, in main
    return command.main(cmd_args)
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\basecommand.py", l
ine 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 77: ordinal
 not in range(128) 

Do You have any idea how to solve it?
Maybe anyone have?

Jonathan Hartley

unread,
Jul 25, 2014, 6:27:12 AM7/25/14
to obey-the-test...@googlegroups.com
Dammit. That is irksome. I don't know how to fix that.

Fabric doesn't seem to have Windows binary installers, so that isn't an
option, I don't think.

Ah! I know! Download the fabric .tar.gz.

Unpack it (this might require you to install some compression utils on
Windows, I don't know.)

When you are done, you should have a directory which contains a 'setup.py'

'cd' into that directory and run that setup.py using python2.7, with the
param 'install':

python2.7 setup.py install


If that didn't work, you could try using easy-install-2.7 to install fabric?

easy-install-2.7 fabric
>> Jonathan Hartley tar...@tartley.com <javascript:> http://tartley.com

Rafał Szymański

unread,
Jul 25, 2014, 6:43:54 AM7/25/14
to Jonathan Hartley, obey-the-test...@googlegroups.com
Thanks Jonathan.
It's not the first time that I'm blocked wiht learning because of this kind problem with Windows. I just decided to install ubuntu next to windows. I didn't want to do that because I'm learning in work and the PC is not mine but I have enough. I'm not feeling so lost with linux now, so I'll try to switch on. Thank You again Jonathan.


--
You received this message because you are subscribed to a topic in the Google Groups "Obey the testing goat!  Test-Driven Web Development with Python book" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/obey-the-testing-goat-book/RHCR1t7mxgo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

harry.p...@gmail.com

unread,
Jul 25, 2014, 7:34:14 AM7/25/14
to Jonathan Hartley, obey-the-test...@googlegroups.com
I'm sure fabric does have a binary installer for windows -- didn't I put a link to it in the book?

--
Sent from a mobile, excuse brevity.
Harry Percival
@hjwp
+44 78877 02511
  Original Message  
From: Jonathan Hartley
Sent: Friday, 25 July 2014 11:27
To: obey-the-test...@googlegroups.com
Subject: Re: [obeythetestinggoat] how to install pip for python2.7
--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.

Rafał Szymański

unread,
Jul 25, 2014, 8:54:02 AM7/25/14
to Harry Percival, Jonathan Hartley, obey-the-test...@googlegroups.com
Yes You did ofcource but I still have problems.
It can be caused by username again but I don't know how to solve it.
Here's what I get:
Downloading/unpacking fabric
  Running setup.py (path:c:\users\szymas~1\appdata\local\temp\pip_build_Szyma˝ski\fabric\setup.py) egg_info for package fabric

    warning: no previously-included files matching '*' found under directory 'sites\docs\_build'
    warning: no previously-included files matching '*' found under directory 'sites\www\_build'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
Cleaning up...
Exception:
Traceback (most recent call last):
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\req.py", line 1234, in prepare_files
    req_to_install.assert_source_matches_version()
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\req.py", line 464, in assert_source_matches_version
    % (display_path(self.source_dir), version, self))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 62: ordinal not in range(128)

Traceback (most recent call last):
  File "c:\Python27\Scripts\pip2-script.py", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip2')()
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\__init__.py", line 185, in main
    return command.main(cmd_args)
  File "c:\Python27\lib\site-packages\pip-1.5.6-py2.7.egg\pip\basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 77: ordinal not in range(128)

I'd be very happy if You could help me again, so anyway I will install ubuntu in a few days.



You received this message because you are subscribed to a topic in the Google Groups "Obey the testing goat!  Test-Driven Web Development with Python book" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/obey-the-testing-goat-book/RHCR1t7mxgo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to obey-the-testing-go...@googlegroups.com.

harry.p...@gmail.com

unread,
Jul 25, 2014, 8:58:06 AM7/25/14
to Rafał Szymański, Jonathan Hartley, obey-the-test...@googlegroups.com
That looks like one of our unicode path issues again... can you change into a different directory?

--
Sent from a mobile, excuse brevity.
Harry Percival
@hjwp
+44 78877 02511
From: Rafał Szymański
Sent: Friday, 25 July 2014 13:54
To: Harry Percival
Cc: Jonathan Hartley; obey-the-test...@googlegroups.com

Rafał Szymański

unread,
Jul 25, 2014, 9:08:55 AM7/25/14
to Harry Percival, Jonathan Hartley, obey-the-test...@googlegroups.com
Yes I tried a few times but obviously don't know how

Rafał Szymański

unread,
Jul 25, 2014, 9:31:26 AM7/25/14
to Harry Percival, Jonathan Hartley, obey-the-test...@googlegroups.com
Never mind. Next week I'll try install ubuntu.
Have a nice weekend everyone.

Steve Young

unread,
Jul 25, 2014, 11:24:19 AM7/25/14
to Rafał Szymański, Harry Percival, Jonathan Hartley, obey-the-test...@googlegroups.com
On Fri, Jul 25, 2014 at 8:31 AM, Rafał Szymański <r.szy...@gmail.com> wrote:
Never mind. Next week I'll try install ubuntu.
Have a nice weekend everyone.

My laptop/main computer is Windows - for a number of reasons that I cannot change, and I actually like Windows (no hate mail please)...  BUT for programming for django or web related I too became tired of trying to make things work on Windows.  After noticing most python programmers were using some form of linux, and most web servers are linux based, I decided it will be better in the long run to join the club.  Not wanting to purchase another machine, I installed the free VMWare player on my Windows machine and created a Ubuntu VM.  At first it was difficult learning vmware and linux, but day by day I became more comfortable with both and now I can switch easily between linux and windows.  

If you are comfortable with virtualenv the concept is similar - remember first using it and trying to get your head wrapped around the commands, installation, keeping track of the virtualenvs, etc.  Then after the adjustment period you see how awesome it is and how it is so easy to try different things.  Same thing with running the VMs.  In the beginning I created a new VM for each project. This was a little overkill, but it helped me learn different brands of linux and keep things separated.  And whenever I start a tutorial I tried to use the same build and versions that the author used to reduce the unusual problems that can make me want to quit. 

Now I have one Ubuntu VM with several projects, including 2 superlists!   And I am so happy whenever I remember how much time I am saving by not having to hack things to work on Windows.  Good luck.

 

Rafał Szymański

unread,
Jul 26, 2014, 6:47:27 AM7/26/14
to obey-the-test...@googlegroups.com, r.szy...@gmail.com, harry.p...@gmail.com, tar...@tartley.com
Jonathan,
Thank You for your engagement in solving my problem and willingness to share an idea of VMWare. Is it second time You try to understand my problems and recommend the VMWare. It's nice of You. I appreciate it a lot. In thank for this I'd like to share something with You. I get interesting in programming four years ago by an accident. I tried HTML and CSS and felt that is really great thing but soon realized that it's not enough to bring my ideas to life. Then I was learning PHP. Why? I don't know. I have no computer or IT education. I have quite fair experience in running own business but programming was new thing for me. I wasted few months of learning PHP and by another accident I discover python. I bought Learning Python and it was like to discover poetry. I felt that learning python is splendid and genius. It was relaxing me and what surprising bringing almost physical pleasure. After a Spitzer book I know that it can be true because our brains likes puzzles like math or programming which is changing some waves in brains and brings kinds of pleasure. I was even more because I had a great pleasure to correspond occasionally with Mark Lutz. Python Guru writes to me! It was amazing. He helped me every time I asked for. I didn't met something like that before. I was totally happy when we found we both are big fans of Twin Peaks! Then I bought his Programming and read almost all but it appears it is not what I was looking for. Then I found django. I felt that it is another Bingo. But I was very confused about all this linux apt-get stuff in every tutorial I tried. Mark Lutz use Windows. I use Windows for whole life. I didn't even know what is linux few month ago. I couldn't embrace the concept. I tried a lot of places to really start learning django but everywhere were problems. I couldn't solve it by myself and support was usually poor. Then I found PythonAnywhere which was first place where everything was working smoothly and all guys was like waiting for my questions. Specially Giles Thomas. I felt like his working there only for me. He is like Mark Lutz - patience and understanding. Ready to bringing help for tiring rookie. After a few weeks with django tutorial I felt like  this tutorial is missing something. I've read Two Spoons of Django where author recommend Harry's TDD book. So I bought it and it was another BINGO. What a book! It's like another great adventure. Python shines again and learning is great fun. And support! Harry is like a great friend. He pulls me by ears chapter by chapter. He has time for every stupid question and always help me. His sense of humor is genius and the book is really changing everything. Now Jonathan You see I trully love python and django. But all this installing, configuring, settings is out of joy for me. All this problems with Windows wasted so much my time and stolen joy and that I don't want to spend time form another thing like VMWare. Linux is not black magic for me now. I even start to like it. It's like vim. It was ugly in the beginning. I tried this because Harry told to try. I was using Komode which is beauty but now I'm really thankfully that I can write in Vim. It's great tool. It's so fast. It lets me feel pleasure with writing code with no wasting time thing with no matter. It's not so beauty like Komodo but I see this beauty in code and Vim helps me with it. So I decided to change OS at least for good. The fact I was waiting with this decision for so long is that PC is not mine;) I learn in work;)))
Thank You again.

Harry Percival

unread,
Jul 26, 2014, 10:58:41 AM7/26/14
to Rafał Szymański, obey-the-test...@googlegroups.com, Jonathan Hartley
Thanks for a lovely email Rafal!  I'll forward it to Giles, I think he'll be pleased.

Re: the ongoing path/windows problems, the ultimate solution may well be to switch to ubuntu, either dual boot or in a VM.  I've never tried VMware, but Virtualbox is free and works ok.

If you want to give it another crack on windows, I'd try this:

- set up a new user account on your windows.  Name it "rafal", or "raf", or any name with only ascii characters.  Choose English as the language. Then maybe all the unicode stuff will stop being broken?   If that does fix it,  you should probably do a bug report against pip -- it really should be able to handle character encoding issues!

HP
--
------------------------------
Harry J.W. Percival
------------------------------
Twitter: @hjwp
Mobile:  +44 (0) 78877 02511
Skype:         harry.percival

Steve Young

unread,
Jul 27, 2014, 9:39:04 AM7/27/14
to hj...@cantab.net, Rafał Szymański, obey-the-test...@googlegroups.com, Jonathan Hartley
For what it's worth, I have also used Virtualbox, and the Hyper-V that comes with Windows 8.  They each work ok, but they both lacked some features that VMWare player has that I was already used to.  

"Linux is not black magic for me now. I even start to like it."

That is a good thing - and really the main point of my earlier comments - Linux is what you 'need' to add to your tool belt, a virtual machine is just a tool to make it easier.

"It's like vim. It was ugly in the beginning. I tried this because Harry told to try. I was using Komode which is beauty but now I'm really thankfully that I can write in Vim. It's great tool. It's so fast. It lets me feel pleasure with writing code with no wasting time thing with no matter."

I will have to give vim a try again.  I love my Pycharm ide, and it has VIM shortcuts.  My problem is I use the dvorak keyboard and end up having to remap some of the keys...  

I also had the same experience with getting help from others - I spent over a year looking at different languages, tried java for about 6 months, before settling on python.  It seemed that the python programmers enjoyed programming and got things done.

Steve

Steve


--

Jonathan Hartley

unread,
Jul 27, 2014, 3:14:57 PM7/27/14
to obey-the-test...@googlegroups.com
It might be because your username and hence your home directory have unicode characters in them. Try in a directory that isn't in your home directory.

Jonathan Hartley

unread,
Jul 27, 2014, 3:44:24 PM7/27/14
to obey-the-test...@googlegroups.com
All very splendid, and heartwarming to hear. I share your love of Python and all the wonderful Python people. But for the record, it wasn't me who wrote that last one, it was Steve Young.

Best,

    Jonathan
--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rafał Szymański

unread,
Jul 27, 2014, 3:48:49 PM7/27/14
to Jonathan Hartley, obey-the-test...@googlegroups.com
Yeah. I noticed that a minute ago;) I think it's typical mistake I make all the time in coding.
So thank You Steve!


--
You received this message because you are subscribed to a topic in the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/obey-the-testing-goat-book/RHCR1t7mxgo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to obey-the-testing-go...@googlegroups.com.

Francois Brochu

unread,
Jul 29, 2014, 5:10:38 PM7/29/14
to obey-the-test...@googlegroups.com
Here is another lovely way for the Red Hat Clones user out there  Look into SCL (Software Collection L? Library?)

I use Centos
  yum install centos-release-SCL

and now you can 'yum install python27' it so easy

I put the following at the end of my .bashrc to remind me that scl is on the system

*****************************************
*********** To enter  SCL ***************
***** scl enable python27 bash **********
*****************************************
***** type "exit" to exit SCL ***********
*****************************************
>  scl enable python27 bash

Virtualenv was install automatically when you install python27

  1. virtualenv projectName
  2. cd projectName
  3. source bin/activate
    • notice you prompt begin with (projectName)
      1. easy_install pip
      2. pip install fabric
        • Successfully installed fabric paramiko pycrypto ecdsa
      3. you are ready to create fabfile
  4. and to leave virtualenv type 'deactivate'
  5. to leave SCL type 'exit'
This made my life so much easier I deployed SCL in all my labs now

Regards 

Rafał Szymański

unread,
Nov 14, 2014, 3:25:12 AM11/14/14
to obey-the-test...@googlegroups.com
It's been a while since I started this thread and bored readers by banal problems with Windows. I have PC with ubuntu 14.04 installed for few weeks and things which took days then, takes minutes now. It's a big surprise to me the difference in working on these two OS is so huge. All these instalations problems just gone and took all the frustration. Pure joy and passion left.
Have a nice weekend everyone.

harry.p...@gmail.com

unread,
Nov 14, 2014, 4:50:54 AM11/14/14
to Rafał Szymański, obey-the-test...@googlegroups.com
:-)

But remember, you've only traded one type of frustration for another. Now you have all the unique pleasures of linux-on-the-desktop to look forward to... working peripherals? hardware accelerated video on youtube? Hibernate? Not for you sonny! Not any more...


--
Sent from a mobile, excuse brevity.
Harry Percival
@hjwp
+44 78877 02511
From: Rafał Szymański
Sent: Friday, 14 November 2014 08:25
Subject: [obeythetestinggoat] Re: how to install pip for python2.7

--

Danlan Chen

unread,
Oct 23, 2016, 7:55:08 AM10/23/16
to Obey the testing goat! Test-Driven Web Development with Python book

Hello, I have a problem when I am running this code below, do you have any idea?

sudo easy_install-2.7 pip

Processing pip

error: Not a recognized archive type: pip

Harry Percival

unread,
Oct 23, 2016, 7:58:47 AM10/23/16
to Danlan Chen, Obey the testing goat! Test-Driven Web Development with Python book

Try downloading get-pip from https://pip.pypa.io/en/stable/installing/ and running it with "sudo python2.7 get-pip.py". ?


--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-go...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

--
Harry Percival
+44 78877 02511

Danlan Chen

unread,
Oct 23, 2016, 8:02:15 AM10/23/16
to Obey the testing goat! Test-Driven Web Development with Python book, danlanc...@gmail.com
Thank you for the reply, I found /usr/local/bin/pip is actually pip2.7


On Sunday, 23 October 2016 20:58:47 UTC+9, Harry Percival wrote:

Try downloading get-pip from https://pip.pypa.io/en/stable/installing/ and running it with "sudo python2.7 get-pip.py". ?


On Sun, 23 Oct 2016, 12:55 Danlan Chen, <danlanc...@gmail.com> wrote:

Hello, I have a problem when I am running this code below, do you have any idea?

sudo easy_install-2.7 pip

Processing pip

error: Not a recognized archive type: pip

On Thursday, 24 July 2014 20:33:54 UTC+9, Rafał Szymański wrote:
Hi there!
I'd like to install fabric.
pip install fabric is installing it for python3.4. I have python2.7 but don't have pip for this version. I was trying to find some explenation how to do that but ech of them are more complicated. Could anyone tell me hot to install pip for python 2.7 in a step-by-step way, please?

--
You received this message because you are subscribed to the Google Groups "Obey the testing goat! Test-Driven Web Development with Python book" group.
To unsubscribe from this group and stop receiving emails from it, send an email to obey-the-testing-goat-book+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Utkarsh Kajaria

unread,
Jun 22, 2017, 5:01:51 AM6/22/17
to Obey the testing goat! Test-Driven Web Development with Python book, tar...@tartley.com
This really helped me out. Thanks Jon!

Joe Allen

unread,
Sep 28, 2017, 12:21:55 PM9/28/17
to Obey the testing goat! Test-Driven Web Development with Python book
Thanks Jonathan, I'd almost given up and your instructions sorted everything!

Reply all
Reply to author
Forward
0 new messages