Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing pip using easy_install

I don't have root access and i want to install python from scratch. So I downloaded the python source code and compiled it. Next I wanted to install pip. But when I ran python get-pip.py I got this error:

ImportError: cannot import name HTTPSHandler

Not having root access then I couldn't install stuff needed. So I thought maybe I can install pip with easy_install so I went and installed setuptools which has easy_install. But when I run easy_install pip I get this error:

Searching for pip
Reading https://pypi.python.org/simple/pip/
Download error on https://pypi.python.org/simple/pip/: unknown url type: https -- Some packages may not be found!
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: unknown url type: https -- Some packages may not be found!
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')

So now how to install pip? I'm really going crazy!

Edit: I can't use virutalenv

like image 476
Jack Twain Avatar asked Oct 09 '14 13:10

Jack Twain


People also ask

What is easy_install pip?

easy_install, now deprecated, was released in 2004 as part of setuptools. It was notable at the time for installing packages from PyPI using requirement specifiers, and automatically installing dependencies.

How do you do pip install using CMD?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process.


3 Answers

try this to install pip : "easy_install-2.7 -U --user pip"

**another important info**  

To install pip on Ubuntu, Debian or Linux Mint:

$ sudo apt-get install python-pip 

To install pip on Fedora:

$ sudo yum install python-pip 

To install pip on CentOS, first enable EPEL repository, and then run:

$ sudo yum install python-pip 

To install pip on Archlinux:

$ sudo pacman -S python-pip 
like image 164
Priyank Avatar answered Sep 28 '22 03:09

Priyank


This isn't precisely answering original question but if you're unfortunate enough to be trying to install pip with easy_install on centos6, I hope this helps.

This used to work but now fails with below error:

$ docker run -ti centos:6 bash -c 'yum install -y python-setuptools && easy_install pip'
...
Installed:
  python-setuptools.noarch 0:0.6.10-3.el6                                                                                                                       

Complete!
Searching for pip
Reading http://pypi.python.org/simple/pip/
Couldn't find index page for 'pip' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for pip
error: Could not find suitable distribution for Requirement.parse('pip')

I guess http://pypi.python.org got serious about requiring https. If you make this little hack then easy_install pip works. sed --in-place 's#http://pypi.python.org#https://pypi.python.org#g' /usr/lib/python2.6/site-packages/setuptools/command/easy_install.py

like image 21
jamshid Avatar answered Sep 28 '22 05:09

jamshid


For those who have no root access, here is how I solved the issue.

  1. Download Python (Gzipped source tarball).

  2. Unzip and cd to the Python source directory.

  3. Configure with the "--with-ensurepip=install" flag, e.g.,

    ./configure --prefix=[your-specified-dir] --with-zlib-dir=/usr/lib64 --with-ensurepip=install
    
  4. make & make install

  5. Now you should have a working but out-dated pip. To get the latest pip, download the get-pip.py file and run python get-pip.py

Now you should have the latest pip. Enjoy. :)

like image 28
user1036719 Avatar answered Sep 28 '22 04:09

user1036719