Installing python packages using pip can sometimes be a challenge in China. For some reason, from an aliyun instance, PyPI is sometimes simply too slow or unreachable. Here are a few solutions to get over this issue and install your sweet python packages.

Install through proxy

This is a bit of a quick and dirty solution but works really well for me. For this to work, you will need a “ladder” server accessible from China with a good connection to https://pypi.python.org/ and an SSH server running. The idea is to create a simple SOCKS5 proxy using OpenSSH and run pip commands through that proxy. Unfortunately, pip supports HTTP proxies only. No problem, we will be using proxychains to funnel all connections through our proxy.

Let’s install proxychains on our python machine and configure it to use our local SOCKS5 proxy.

$ sudo apt-get install proxychains

I choose to use a local configuration file in ~/.proxychains/proxychains.conf, see the man page for mode configuration options.

[ProxyList]
socks5 127.0.0.1 1080

I can now start the SOCKS5 proxy through an SSH connection and run pip inside the tunnel.

I recently got my hands on a cheap Moto G through the official tmall shop of Motorola. A dual SIM phone for 799 RMB (around 118€ or $125) with current version of android (5.0.2), 16G of storage and a micro SD slot, what else to say? The only ...

Being an IT person in China can often be a challenge, especially when you’re roaming the interwebz for information. The great firewall of China does stop innocuous content like the angularjs docs or gmail. I think this is harmful to a whole generation of young Chinese IT enthusiasts but ...

I discovered virtualenvwrapper in early 2012, it’s been my tool of choice when working with python since then. Now, mkvirtualenv is the first command I type when starting a project. Then my workflow used to look something close to: