Ismailp
Ismailp

Reputation: 2383

Pip install on Chinese server ssl error

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.

Upvotes: 0

Views: 4144

Answers (3)

cs_stackX
cs_stackX

Reputation: 1527

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

Upvotes: 6

OrangeCube
OrangeCube

Reputation: 398

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)

Upvotes: 1

Niklas9
Niklas9

Reputation: 9386

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.

Upvotes: 1

Related Questions