Repository: conda/conda

Issue:
progress bar uses stderr instead of stdout
This appears to be a regression of https://github.com/conda/conda/issues/536

conda version : 4.5.0
conda-build version : 3.8.0
python version : 3.5.5.final.0
platform : win-64

Run a command such as follows:

conda create --yes -n TestEnv1 requests > stdout.txt 2> stderr.txt

Note that all the progress bar output goes into stderr.txt, while the rest goes into stdout.txt, as expected. Here's my stderr.txt:


win_inet_pton 1.0.1:            |   0% 
win_inet_pton 1.0.1: ########## | 100% 

cffi 1.11.5:            |   0% 
cffi 1.11.5: #######5   |  75% 
cffi 1.11.5: #########6 |  96% 
cffi 1.11.5: ########## | 100% 

pycparser 2.18:            |   0% 
pycparser 2.18: #######5   |  75% 
pycparser 2.18: #########7 |  97% 
pycparser 2.18: ########## | 100% 

pip 9.0.3:            |   0% 
pip 9.0.3: #3         |  14% 
pip 9.0.3: #####7     |  57% 
pip 9.0.3: #######5   |  75% 
pip 9.0.3: ########7  |  87% 
pip 9.0.3: #########6 |  97% 
pip 9.0.3: ########## | 100% 

chardet 3.0.4:            |   0% 
chardet 3.0.4: #######5   |  75% 
chardet 3.0.4: #########5 |  95% 
chardet 3.0.4: ########## | 100% 

six 1.11.0:            |   0% 
six 1.11.0: ########1  |  82% 
six 1.11.0: ########## | 100% 

vs2015_runtime 14.0.25420:            |   0% 
vs2015_runtime 14.0.25420: ###1       |  31% 
vs2015_runtime 14.0.25420: #######5   |  75% 
vs2015_runtime 14.0.25420: ########5  |  86% 
vs2015_runtime 14.0.25420: #########5 |  95% 
vs2015_runtime 14.0.25420: ########## | 100% 

certifi 2018.1.18:            |   0% 
certifi 2018.1.18: ########8  |  88% 
certifi 2018.1.18: ########## | 100% 

openssl 1.0.2o:            |   0% 
openssl 1.0.2o: 1          |   2% 
openssl 1.0.2o: #8         |  18% 
openssl 1.0.2o: ###6       |  36% 
openssl 1.0.2o: #####4     |  55% 
openssl 1.0.2o: #######3   |  73% 
openssl 1.0.2o: ########5  |  86% 
openssl 1.0.2o: #########5 |  96% 
openssl 1.0.2o: ########## | 100% 

idna 2.6:            |   0% 
idna 2.6: #######8   |  79% 
idna 2.6: ########## | 100% 

asn1crypto 0.24.0:            |   0% 
asn1crypto 0.24.0: #######5   |  75% 
asn1crypto 0.24.0: #########5 |  95% 
asn1crypto 0.24.0: ########## | 100% 

pysocks 1.6.8:            |   0% 
pysocks 1.6.8: ########## | 100% 

cryptography 2.2.2:            |   0% 
cryptography 2.2.2: 2          |   2% 
cryptography 2.2.2: #######5   |  75% 
cryptography 2.2.2: #########3 |  93% 
cryptography 2.2.2: ########## | 100% 

urllib3 1.22:            |   0% 
urllib3 1.22: #######5   |  75% 
urllib3 1.22: #########5 |  96% 
urllib3 1.22: ########## | 100% 

requests 2.18.4:            |   0% 
requests 2.18.4: #######7   |  77% 
requests 2.18.4: ########## | 100% 

python 3.6.5:            |   0% 
python 3.6.5: 2          |   3% 
python 3.6.5: 7          |   7% 
python 3.6.5: #2         |  12% 
python 3.6.5: #6         |  17% 
python 3.6.5: ##1        |  21% 
python 3.6.5: ##5        |  26% 
python 3.6.5: ###        |  30% 
python 3.6.5: ###4       |  35% 
python 3.6.5: ###9       |  40% 
python 3.6.5: ####4      |  44% 
python 3.6.5: ####8      |  48% 
python 3.6.5: #####2     |  53% 
python 3.6.5: #####7     |  58% 
python 3.6.5: ######2    |  62% 
python 3.6.5: ######6    |  67% 
python 3.6.5: #######1   |  71% 
python 3.6.5: #######5   |  76% 
python 3.6.5: #######8   |  79% 
python 3.6.5: ########1  |  81% 
python 3.6.5: ########2  |  83% 
python 3.6.5: ########4  |  84% 
python 3.6.5: ########5  |  85% 
python 3.6.5: ########5  |  86% 
python 3.6.5: ########6  |  87% 
python 3.6.5: ########7  |  87% 
python 3.6.5: ########7  |  88% 
python 3.6.5: ########8  |  88% 
python 3.6.5: ########8  |  89% 
python 3.6.5: ########8  |  89% 
python 3.6.5: ########9  |  89% 
python 3.6.5: ########9  |  90% 
python 3.6.5: ########9  |  90% 
python 3.6.5: #########  |  90% 
python 3.6.5: #########  |  91% 
python 3.6.5: #########  |  91% 
python 3.6.5: #########1 |  91% 
python 3.6.5: #########1 |  92% 
python 3.6.5: #########1 |  92% 
python 3.6.5: #########2 |  92% 
python 3.6.5: #########2 |  93% 
python 3.6.5: #########2 |  93% 
python 3.6.5: #########3 |  93% 
python 3.6.5: #########3 |  93% 
python 3.6.5: #########3 |  94% 
python 3.6.5: #########4 |  94% 
python 3.6.5: #########4 |  94% 
python 3.6.5: #########4 |  95% 
python 3.6.5: #########4 |  95% 
python 3.6.5: #########5 |  95% 
python 3.6.5: #########5 |  95% 
python 3.6.5: #########5 |  96% 
python 3.6.5: #########6 |  96% 
python 3.6.5: #########6 |  96% 
python 3.6.5: #########6 |  97% 
python 3.6.5: #########6 |  97% 
python 3.6.5: #########7 |  97% 
python 3.6.5: #########7 |  97% 
python 3.6.5: #########7 |  98% 
python 3.6.5: #########7 |  98% 
python 3.6.5: #########8 |  98% 
python 3.6.5: #########8 |  98% 
python 3.6.5: #########8 |  99% 
python 3.6.5: #########8 |  99% 
python 3.6.5: #########8 |  99% 
python 3.6.5: #########9 |  99% 
python 3.6.5: #########9 |  99% 
python 3.6.5: #########9 | 100% 
python 3.6.5: #########9 | 100% 
python 3.6.5: #########9 | 100% 
python 3.6.5: #########9 | 100% 
python 3.6.5: ########## | 100% 

pyopenssl 17.5.0:            |   0% 
pyopenssl 17.5.0: ########5  |  86% 
pyopenssl 17.5.0: ########## | 100% 

setuptools 39.0.1:            |   0% 
setuptools 39.0.1: #######5   |  75% 
setuptools 39.0.1: ########9  |  89% 
setuptools 39.0.1: ########## | 100% 

ca-certificates 2018.03.07:            |   0% 
ca-certificates 2018.03.07: #######6   |  77% 
ca-certificates 2018.03.07: ########## | 100% 

wincertstore 0.2:            |   0% 
wincertstore 0.2: ########## | 100% 

wheel 0.31.0:            |   0% 
wheel 0.31.0: ########5  |  86% 
wheel 0.31.0: ########## | 100% 

vc 14:            |   0% 
vc 14: ########## | 100% 
progress bar uses stderr instead of stdout
This appears to be a regression of https://github.com/conda/conda/issues/536

conda version : 4.5.0
conda-build version : 3.8.0
python version : 3.5.5.final.0
platform : win-64

Run a command such as follows:

conda create --yes -n TestEnv1 requests > stdout.txt 2> stderr.txt

Note that all the progress bar output goes into stderr.txt, while the rest goes into stdout.txt, as expected. Here's my stderr.txt:


win_inet_pton 1.0.1:            |   0% 
win_inet_pton 1.0.1: ########## | 100% 

cffi 1.11.5:            |   0% 
cffi 1.11.5: #######5   |  75% 
cffi 1.11.5: #########6 |  96% 
cffi 1.11.5: ########## | 100% 

pycparser 2.18:            |   0% 
pycparser 2.18: #######5   |  75% 
pycparser 2.18: #########7 |  97% 
pycparser 2.18: ########## | 100% 

pip 9.0.3:            |   0% 
pip 9.0.3: #3         |  14% 
pip 9.0.3: #####7     |  57% 
pip 9.0.3: #######5   |  75% 
pip 9.0.3: ########7  |  87% 
pip 9.0.3: #########6 |  97% 
pip 9.0.3: ########## | 100% 

chardet 3.0.4:            |   0% 
chardet 3.0.4: #######5   |  75% 
chardet 3.0.4: #########5 |  95% 
chardet 3.0.4: ########## | 100% 

six 1.11.0:            |   0% 
six 1.11.0: ########1  |  82% 
six 1.11.0: ########## | 100% 

vs2015_runtime 14.0.25420:            |   0% 
vs2015_runtime 14.0.25420: ###1       |  31% 
vs2015_runtime 14.0.25420: #######5   |  75% 
vs2015_runtime 14.0.25420: ########5  |  86% 
vs2015_runtime 14.0.25420: #########5 |  95% 
vs2015_runtime 14.0.25420: ########## | 100% 

certifi 2018.1.18:            |   0% 
certifi 2018.1.18: ########8  |  88% 
certifi 2018.1.18: ########## | 100% 

openssl 1.0.2o:            |   0% 
openssl 1.0.2o: 1          |   2% 
openssl 1.0.2o: #8         |  18% 
openssl 1.0.2o: ###6       |  36% 
openssl 1.0.2o: #####4     |  55% 
openssl 1.0.2o: #######3   |  73% 
openssl 1.0.2o: ########5  |  86% 
openssl 1.0.2o: #########5 |  96% 
openssl 1.0.2o: ########## | 100% 

idna 2.6:            |   0% 
idna 2.6: #######8   |  79% 
idna 2.6: ########## | 100% 

asn1crypto 0.24.0:            |   0% 
asn1crypto 0.24.0: #######5   |  75% 
asn1crypto 0.24.0: #########5 |  95% 
asn1crypto 0.24.0: ########## | 100% 

pysocks 1.6.8:            |   0% 
pysocks 1.6.8: ########## | 100% 

cryptography 2.2.2:            |   0% 
cryptography 2.2.2: 2          |   2% 
cryptography 2.2.2: #######5   |  75% 
cryptography 2.2.2: #########3 |  93% 
cryptography 2.2.2: ########## | 100% 

urllib3 1.22:            |   0% 
urllib3 1.22: #######5   |  75% 
urllib3 1.22: #########5 |  96% 
urllib3 1.22: ########## | 100% 

requests 2.18.4:            |   0% 
requests 2.18.4: #######7   |  77% 
requests 2.18.4: ########## | 100% 

python 3.6.5:            |   0% 
python 3.6.5: 2          |   3% 
python 3.6.5: 7          |   7% 
python 3.6.5: #2         |  12% 
python 3.6.5: #6         |  17% 
python 3.6.5: ##1        |  21% 
python 3.6.5: ##5        |  26% 
python 3.6.5: ###        |  30% 
python 3.6.5: ###4       |  35% 
python 3.6.5: ###9       |  40% 
python 3.6.5: ####4      |  44% 
python 3.6.5: ####8      |  48% 
python 3.6.5: #####2     |  53% 
python 3.6.5: #####7     |  58% 
python 3.6.5: ######2    |  62% 
python 3.6.5: ######6    |  67% 
python 3.6.5: #######1   |  71% 
python 3.6.5: #######5   |  76% 
python 3.6.5: #######8   |  79% 
python 3.6.5: ########1  |  81% 
python 3.6.5: ########2  |  83% 
python 3.6.5: ########4  |  84% 
python 3.6.5: ########5  |  85% 
python 3.6.5: ########5  |  86% 
python 3.6.5: ########6  |  87% 
python 3.6.5: ########7  |  87% 
python 3.6.5: ########7  |  88% 
python 3.6.5: ########8  |  88% 
python 3.6.5: ########8  |  89% 
python 3.6.5: ########8  |  89% 
python 3.6.5: ########9  |  89% 
python 3.6.5: ########9  |  90% 
python 3.6.5: ########9  |  90% 
python 3.6.5: #########  |  90% 
python 3.6.5: #########  |  91% 
python 3.6.5: #########  |  91% 
python 3.6.5: #########1 |  91% 
python 3.6.5: #########1 |  92% 
python 3.6.5: #########1 |  92% 
python 3.6.5: #########2 |  92% 
python 3.6.5: #########2 |  93% 
python 3.6.5: #########2 |  93% 
python 3.6.5: #########3 |  93% 
python 3.6.5: #########3 |  93% 
python 3.6.5: #########3 |  94% 
python 3.6.5: #########4 |  94% 
python 3.6.5: #########4 |  94% 
python 3.6.5: #########4 |  95% 
python 3.6.5: #########4 |  95% 
python 3.6.5: #########5 |  95% 
python 3.6.5: #########5 |  95% 
python 3.6.5: #########5 |  96% 
python 3.6.5: #########6 |  96% 
python 3.6.5: #########6 |  96% 
python 3.6.5: #########6 |  97% 
python 3.6.5: #########6 |  97% 
python 3.6.5: #########7 |  97% 
python 3.6.5: #########7 |  97% 
python 3.6.5: #########7 |  98% 
python 3.6.5: #########7 |  98% 
python 3.6.5: #########8 |  98% 
python 3.6.5: #########8 |  98% 
python 3.6.5: #########8 |  99% 
python 3.6.5: #########8 |  99% 
python 3.6.5: #########8 |  99% 
python 3.6.5: #########9 |  99% 
python 3.6.5: #########9 |  99% 
python 3.6.5: #########9 | 100% 
python 3.6.5: #########9 | 100% 
python 3.6.5: #########9 | 100% 
python 3.6.5: #########9 | 100% 
python 3.6.5: ########## | 100% 

pyopenssl 17.5.0:            |   0% 
pyopenssl 17.5.0: ########5  |  86% 
pyopenssl 17.5.0: ########## | 100% 

setuptools 39.0.1:            |   0% 
setuptools 39.0.1: #######5   |  75% 
setuptools 39.0.1: ########9  |  89% 
setuptools 39.0.1: ########## | 100% 

ca-certificates 2018.03.07:            |   0% 
ca-certificates 2018.03.07: #######6   |  77% 
ca-certificates 2018.03.07: ########## | 100% 

wincertstore 0.2:            |   0% 
wincertstore 0.2: ########## | 100% 

wheel 0.31.0:            |   0% 
wheel 0.31.0: ########5  |  86% 
wheel 0.31.0: ########## | 100% 

vc 14:            |   0% 
vc 14: ########## | 100% 


Discussion:

Resolving patch:
diff --git a/conda/common/io.py b/conda/common/io.py
--- a/conda/common/io.py
+++ b/conda/common/io.py
@@ -387,7 +387,8 @@ def __init__(self, description, enabled=True, json=False):
         elif enabled:
             bar_format = "{desc}{bar} | {percentage:3.0f}% "
             try:
-                self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1)
+                self.pbar = tqdm(desc=description, bar_format=bar_format, ascii=True, total=1,
+                                 file=sys.stdout)
             except EnvironmentError as e:
                 if e.errno in (EPIPE, ESHUTDOWN):
                     self.enabled = False


Test patch: