The setup should not depend on the module it is setting up nor any depen...

...dencies which would be resolved after the setup.

I've come across an issue when installing ipwhois.

When, for example installing from pip:
    pip install ipwhois

results in this error:
    ImportError: No module named 'dns'

This is because the setup.py file acquires the version number from the ipwhois module.

The problem here is that the ipwhois module actually hasn't been installed yet and thus 
a circular dependency made, since the actual setup process, which installs the dependencies, 
actually depends on the module it should install, and the module hasn't yet had its dependencies satisfied.

The solution could be:
Install the dns module before even attempting to install ipwhois.

This, however, is not a feasible solution for deployments such as Heroku, Openshift and other "cloud" providers since the gears/nodes sometimes spin down and then, when using the requirements.txt flle to install the dependencies again, will fail.

This is because pip features "look before you leap" - pip ensures that all dependencies can be found, unpacked, and have working setup.py before it installs any of them. source: post #3 https://github.com/pypa/pip/issues/25.

A better solution would be to not having to import ipwhois in the actual setup.py file, as is shown in this pull request.