There appears to be an interaction problem with https://github.com/kivy/python-for-android and recent pip: it appears pip uses formatting codes to rewrite already written output, and this clashes with whatever python-for-android is doing and I appear to get chunks of missing output or things written half over the terminal and I can’t see the actual error. This is the only readable error part I am getting: working: pip._internal.exceptions.InstallationError: Could not build wheels for sfxscan which use PEP...(and 37 more) along with Found link https://files.pythonhosted.org/packages/c4/27/39e87b69a9a65cc89b6d83d21e7dec... (1301154 more, please see e.stdout). Nothing else of use as far as I can see
Earlier pip versions I don’t think I ever saw do this, has there been a recent change in how formatting works? Is there an option to turn this fancy but for me essentially useless feature off so I can get untampered output?
I would have filed a bug but I’m not 100% sure yet this is the culprit, but if anyone can tell me how to disable all that special terminal cursor and backspace rewrite and whatever stuff I would love to try
Janky way of doing it, but I slapped this together as pipcap.py, to run as $ python pipcap.py:
import sys
from contextlib import redirect_stdout, redirect_stderr
from io import StringIO
from pip._internal import main as pip_main
sys.argv = ["pip", "list"]
new_stdout = StringIO()
new_stderr = StringIO()
with redirect_stdout(new_stdout):
with redirect_stderr(new_stderr):
pip_main()
print('stdout:')
print(new_stdout.getvalue().encode(encoding='utf-8'))
print('stderr:')
print(new_stderr.getvalue().encode(encoding='utf-8'))
Replace sys.argv = ['pip', 'list'] with whatever command sequence is of interest. Not sure if the .encode() is really necessary, but.
For whatever arcane reason (it detects the stream isn’t a terminal, maybe?) all of the ANSI coloring gets stripped out when I run it on my Debian box:
$ python3.6 --version
Python 3.6.8
$ python3.6 pipcap.py
stdout:
b'Package Version\n---------- -------\npip 19.0.3 \nsetuptools 40.6.2 \nvirtualenv 16.4.3 \n'
stderr:
b"You are using pip version 19.0.3, however version 19.1.1 is available.\nYou should consider upgrading via the 'pip install --upgrade pip' command.\n"
Is there a way to do it with a command line option? I’m not running pip directly (python-for-android is) so getting a script in there is a bit of a janky process.
Also I’ve run multiple times and whatever pip does makes everything go completely haywire when I resize the terminal as well, and I’ve definitely once had the error backtrace show up and once NOT at a different output width. So that’s really a bit of a problem
(at the one width where it did show up, it was cut off horizontally so I couldn’t read the essential part of the error, and it wasn’t just wrapped but the right half MISSING - really broken output formatting)
This is all I’ve seen for MINUTES now, and at some point it suddenly expands these 1013 or more with some rewriting magic that just does major harm to my output. Isn’t there a switch to turn that off? I’m sure a couple of color codes don’t do much damage, but whatever is going on with this admittedly fancy but otherwise useless rewriting is really causing me headaches over here
I really don’t want to trim anything down, I just want to get all of the actual output
Edit: I guess your script might work, I’ll give that a try later when I get around to it. but an option would make things a lot easier for sure, I’m not even 100% sure still this is pip’s rewriting messing it up so much but it looks like it
Ok, I just tried both --no-color and --progress-bar off and sadly pip still rewrites all left and right through the output messing things up… I suppose it’s time for a ticket, even if this isn’t why output goes missing it is a bit of a nuisance that it can’t be disabled even if just to see if that messes with something so much to cause that missing output
Edit: unless there is an option of course but in pip3 install --help I can’t see one that looks like it either
Edit 2: nice, got lucky and had another run where despite the rewritten output I got the build error at a terminal width where I could actually read it. pretty sure it wasn’t any of the options though I think I just got rather lucky
Oh, interesting idea! Yes, I’m indeed using setuptools. Now that I’m thinking about it, I think the output may have changed once I started using pyproject.toml so I wonder if this is related to the new build isolation?
<nod>, my pip installs definitely changed when I switched to pyproject.toml, such that there’s now a spinner during the build step. That’s probably what’s mucking with things.
Yeah that sounds like that might be it. Wish there was a way to disable it, although finger’s crossed maybe I’ve fixed my build issue so maybe I’m good for now
This almost definitely isn’t pip, since it doesn’t have any output of the format “(and xyz more)” or see e.stdout etc.
You should be able to disable ANSI output with --progress (color is dependent on the stream being a tty, but --no-color will force it off).
None the less, if that’s not happening, please file a bug report on our issue tracker (https://github.com/pypa/pip/issues/choose) with a minimal example and steps to reproduce and I’ll be more than happy to figure out what we can do.
This has already been raised (and answered) on the pip tracker.
@jtt Please try to avoid reporting the same issue in multiple places, it causes a lot of duplication of effort For those reading this thread, it appears that the problem may lie with the OP’s environment (Python for Android).
@pf_moore I asked here until it seemed established enough there was no option for it (which I easily could have missed) and then it seemed to me like a ticket was the best next step. You can also see this from the timestamps from the posts I hope. I really try not to double post, apologies if it looked like that
(I created the ticket after Brian’s helpful suggestion that it might be the spinner code which seemed reasonable although now it looks like it isn’t, my bad!)
I usually go straight for a ticket, but I was thinking I might save time for everyone involved asking here first to find out if I just had missed an option. So again my apologies if I caused more wasted time, my intention really was to save it (but I messed it up by not linking the ticket once I opened it after the responses here, again, my apologies)