jball037
jball037

Reputation: 1800

Cannot install package 'requests' for Python

I tried installing the requests package for python on my Ubuntu 10.04 server using:

$ pip install requests

But I keep getting the return:

Downloading/unpacking requests Could not fetch URL http://pypi.python.org/simple/requests: Will skip URL (...url...) when looking for download links for requests Could not fetch URL (...url...): Will skip URL (...url...) when looking for download links for requests Cannot fetch index base URL (...url...) Cannot find requirement requests, nor fetch index URL (...url...) Storing complete log in ./pip-log.txt

Please pardon my use of "(...url...)" above, as StackOverflow won't allow me to post more than 2 links.

Here is the traceback in pip-log.txt:

Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/pip.py", line 252, in main
    self.run(options, args)
File "/usr/lib/python2.6/dist-packages/pip.py", line 08, in run
    requirement_set.install_files(finder, force_root_egg_info=self.bundle)
File "/usr/lib/python2.6/dist-packages/pip.py", line 1750, in install_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/usr/lib/python2.6/dist-packages/pip.py", line 996, in find_requirement
    url_name = self._find_url_name(Link(self.index_urls[0]), url_name, req)
File "/usr/lib/python2.6/dist-packages/pip.py", line 1073, in _find_url_name
    raise DistributionNotFound('Cannot find requirement %s, nor fetch index URL %s' % (req, index_url))
DistributionNotFound: Cannot find requirement requests, nor fetch index URL (...url...)

I know pip is working fine, as I've installed many other packages through it. I've also tried installing with easy_install and from source, but both have the same issues. I'm a relative newb to Python/Django, can anyone help point me in the right direction for what the issue is?

Upvotes: 2

Views: 1989

Answers (2)

jball037
jball037

Reputation: 1800

To answer my own question...

It turns out that this didn't have anything to do with how the package was installed, despite what the error messages seemed to be saying. The problem was that I ran my dev server from one of my other terminal windows and never shut it down... ( $ python manage.py runserver [::]:8000 ). It's strange that the error output didn't mention anything about that.

Upvotes: 0

singer
singer

Reputation: 2636

You may try:

  1. Using mirrors like it explained here What to do when PyPI goes down

    pip install --use-mirrors $PACKAGE
    
  2. As it recommended by @sigmavirus24 the second option would be using Base URL of Python Package Index

    pip install -i https://crate.io requests 
    
  3. install package source directly from git

    pip install -e git+https://github.com/kennethreitz/requests#egg=requests
    

Try 1 - sometimes I have same problems when I have poor internet connection or pip is down.

Upvotes: 6

Related Questions