I have a setup.py script for an extension module written in C, which compiles the module as part of the installation procedure. It may ask for some user input before starting the compilation (e.g., asking to install optional components; note that these are not python modules themselves, and are only used in building the extension module). Normally this would be as simple as writing the message to the console and reading input(), but when the script is invoked via PIP, it redirects the console (hides the text printed to stdout until the script finishes running, and shuts off stdin so that any attempt to read from it return an empty string). I managed to circumvent this by working with /dev/tty directly: if sys.stdout.isatty(): sys.stdout.write(text) else: with open('/dev/tty','w') as stdout: stdout.write(text) stdout.flush() and if sys.stdin.isatty(): result=sys.stdin.readline() else: with open('/dev/tty','r') as stdin: result=stdin.readline() This mostly works, but is unix-specific; on Windows there is no /dev/tty, so the hack fails. Moreover, the output to console is sometimes still buffered, despite the use of .flush(), the last line may get swallowed (so the message asking for user input is printed incompletely, leaving them puzzled as to what the script is actually asking them). Two questions: Is it possible to get access to the raw terminal input/output on Windows analogously to the tty hack? Admittedly this is a rather inelegant hack, but I was not able to force PIP to be more user-friendly and allow an interactive input. Am I missing something? The push of the python developers to disable the invocation of python setup.py entirely leaves no option but to make friends with PIP, but its insistence on full automation is not suitable in this case. There is a lengthy discussion in this thread: https://github.com/pypa/pip/issues/2732 – don't know if anything has improved since 2015.. Continue reading...