At startup, IPython (qtconsole) calls socket.gethostbyname_ex(socket.gethostname())[2] to find a list of IP addresses that point to the machine. On a Linux ser
socket.gethostbyname_ex(socket.gethostname())[2]
I had a similar problem. It happened that my hostname was localhost.localdomain, being lazy when installing the OS.
localhost.localdomain
The solution was to give it a sane name by sudo vi /etc/hostname and changing it to myname.mydomain and now it runs in 1s.
sudo vi /etc/hostname