Is there a duck-typing way to know we can't compile extensions?
Yes! You try to build the extension and if it fails then you automatically fall back to using your pure-Python alternative. This way install will also succeed on a system without a C compiler, for example.
The example code that I crib from whenever I'm going to use this hack is simplejson: