0

I'm trying to install Django on a Chinese server on Ubuntu 12.04.

Trying to run pip install djangoand I'm getting this error:

Cannot fetch index base URL http://pypi.pyton.org/simple/
Could not find any downloads that satisfy the requirement django

Complete pip.log is:

Downloading/unpacking django

  Getting page http://pypi.python.org/simple/django
  Could not fetch URL http://pypi.python.org/simple/django: <urlopen error _ssl.c:489: The handshake operation timed out>
  Will skip URL http://pypi.python.org/simple/django when looking for download links for django
  Getting page http://pypi.python.org/simple/
  Could not fetch URL http://pypi.python.org/simple/: The read operation timed out
  Will skip URL http://pypi.python.org/simple/ when looking for download links for django
  Cannot fetch index base URL http://pypi.python.org/simple/

  URLs to search for versions for django:
  * http://pypi.python.org/simple/django/
  Getting page http://pypi.python.org/simple/django/
  Could not fetch URL http://pypi.python.org/simple/django/: timed out
  Will skip URL http://pypi.python.org/simple/django/ when looking for download links for django
  Could not find any downloads that satisfy the requirement django

No distributions at all found for django

I've read that this could be system time issue with the ssl, do you guys have any idea on how I can solve this? Do I need to set a sepcific system time in order to be able to install packages using pip?

Thanks.

Ismailp
  • 2,333
  • 4
  • 37
  • 66
  • dowload the zip file and manually install from django site. or do git clone and install. https://docs.djangoproject.com/en/1.6/topics/install/ – loki Mar 20 '14 at 09:12
  • Yep, that works. Just wondering why this issue arises? I have done this thing 100 times and never before stumbled upon this. – Ismailp Mar 20 '14 at 10:46
  • might be u r behind some proxy or some downtime at the server side try after some time. – loki Mar 20 '14 at 10:49
  • @loki still doesn't work. Actually I can't pip install anything which is quite strange. – Ismailp Mar 20 '14 at 11:57

3 Answers3

4

Great Firewall has been upping its game recently, even against VPNs. You may end up needing to use a different (local) mirror for pip install. At time of writing, this one worked for me:

pip install [YOUR_PACKAGE] -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
cs_stackX
  • 1,407
  • 2
  • 19
  • 27
1

The pypi.pyton.org domain seems to be blocked by the Great Firewall Of China, see more info here - http://en.wikipedia.org/wiki/Golden_Shield_Project. A great site for testing if websites work from inside China is http://www.greatfirewallofchina.org, the site confirms that it's blocked: http://www.greatfirewallofchina.org/index.php?siteurl=http%3A%2F%2Fpypi.python.org.

What you could do is

  1. Try using the Ubuntu default packages instead and install Django with apt-get ( $ sudo apt-get install python-django)
  2. Download the pip archive for Django to a host in another country and then copy that file to your server in China. More info to do this with pip archives can be found here Installing Python packages from local file system folder with pip.
Community
  • 1
  • 1
Niklas9
  • 8,816
  • 8
  • 37
  • 60
1

Also you can run pip with global proxied goagent or through VPN.

UPDATE: http://www.greatfirewallofchina.org/ may report wrong, it tells me no servers were able to reach Baidu just now!(which is definitely accessable)

OrangeCube
  • 398
  • 2
  • 14