Repository: conda/conda

Issue:
Typo in channel name generates application error report
<!--
Hi!  Read this; it's important.

This is an issue tracker for conda -- the package manager.  File feature requests
for conda here, as well as bug reports about something conda has messed up.

If your issue is a bug report or feature request for:
  * a specific conda package from Anaconda ('defaults' channel):
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * a specific conda package from conda-forge:
      ==> file at the corresponding feedstock under https://github.com/conda-forge
  * repo.anaconda.com access and service:
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * anaconda.org access and service:
      ==> file at https://anaconda.org/contact/report
  * commands under 'conda build':
      ==> file at https://github.com/conda/conda-build
  * commands under 'conda env':
      ==> please file it here!
  * all other conda commands that start with 'conda':
      ==> please file it here!

If you continue on, and especially if you are submitting a bug report,

   **please include all requested information below.**

If a maintainer determines the information is required to understand 
your issue, and if it is not provided, your issue may be
closed automatically.

-->

**I'm submitting a...**
  - [x] bug report
  - [ ] feature request


## Current Behavior
<!-- What actually happens?
     If you want to include console output, please use "Steps to Reproduce" below. -->

Conda throws CondaHTTPError and also states the problem.

### Steps to Reproduce
<!-- If the current behavior is a bug, please provide specific, minimal steps to independently reproduce.
     Include the exact conda commands that reproduce the issue and their output between the ticks below. -->
```
[root@1fd6151b88ea ~]# conda install -c defautls conda-build
Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

`$ /opt/conda/bin/conda install -c defautls conda-build`

  environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=/opt/conda
                     PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
                          :/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : /root/.condarc
 populated config files : /root/.condarc
          conda version : 4.5.4
    conda-build version : 3.10.2
         python version : 3.6.5.final.0
       base environment : /opt/conda  (writable)
           channel URLs : https://conda.anaconda.org/defautls/linux-64
                          https://conda.anaconda.org/defautls/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /opt/conda/pkgs
                          /root/.conda/pkgs
       envs directories : /opt/conda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12
                UID:GID : 0:0
             netrc file : None
           offline mode : False


V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V

CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/defautls/noarch/repodata.json>
Elapsed: 00:00.063091
CF-RAY: 4258625a0ae3592d-DFW

The remote server could not find the noarch directory for the
requested channel with url: https://conda.anaconda.org/defautls

As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and
associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is
empty. please request that the channel administrator create
`noarch/repodata.json` and associated `noarch/repodata.json.bz2` files.
$ mkdir noarch
$ echo '{}' > noarch/repodata.json
$ bzip2 -k noarch/repodata.json

You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state.
Further configuration help can be found at <https://conda.io/docs/config.html>.

A reportable application error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]: 
No report sent. To permanently opt-out, use

    $ conda config --set report_errors false
```


## Expected Behavior
<!-- What do you think should happen? -->
Conda shouldn't generate a report. It's the end user's fault, not a fault in conda. It should handle the scenario nicely.

## Environment Information
<details open><summary><code>`conda info`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda info' -->

```
[root@1fd6151b88ea ~]# conda info

     active environment : None
       user config file : /root/.condarc
 populated config files : /root/.condarc
          conda version : 4.5.4
    conda-build version : 3.10.2
         python version : 3.6.5.final.0
       base environment : /opt/conda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /opt/conda/pkgs
                          /root/.conda/pkgs
       envs directories : /opt/conda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12
                UID:GID : 0:0
             netrc file : None
           offline mode : False
```
</p></details>


<details open><summary><code>`conda config --show-sources`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda config --show-sources' -->

```
[root@1fd6151b88ea ~]# conda config --show-sources
==> /root/.condarc <==
add_pip_as_python_dependency: False
show_channel_urls: True
```
</p></details>


<details><summary><code>`conda list --show-channel-urls`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda list --show-channel-urls' -->

```
[root@1fd6151b88ea ~]# conda list --show-channel-url
# packages in environment at /opt/conda:
#
# Name                    Version                   Build  Channel
anaconda-client           1.6.14                   py36_0    defaults
asn1crypto                0.24.0                   py36_0    defaults
beautifulsoup4            4.6.0            py36h49b8c8c_1    defaults
binutils_impl_linux-64    2.28.1               had2808c_3    defaults
binutils_linux-64         7.2.0                        26    defaults
ca-certificates           2018.03.07                    0    defaults
certifi                   2018.4.16                py36_0    defaults
cffi                      1.11.5           py36h9745a5d_0    defaults
chardet                   3.0.4            py36h0f667ec_1    defaults
clyent                    1.2.2            py36h7e57e65_1    defaults
conda                     4.5.4                    py36_0    defaults
conda-build               3.10.2                   py36_0    defaults
conda-concourse-ci        0.1.0                     <pip>
conda-env                 2.6.0                h36134e3_1    defaults
conda-verify              2.0.0            py36h98955d8_0    defaults
cryptography              2.2.2            py36h14c3975_0    defaults
curl                      7.59.0               h84994c4_0    defaults
decorator                 4.3.0                    py36_0    defaults
expat                     2.2.5                he0dffb1_0    defaults
filelock                  3.0.4                    py36_0    defaults
gcc_impl_linux-64         7.2.0                habb00fd_3    defaults
gcc_linux-64              7.2.0                        26    defaults
git                       2.17.0          pl526hb75a9fb_0    defaults
glob2                     0.6              py36he249c77_0    defaults
gxx_impl_linux-64         7.2.0                hdf63c60_3    defaults
gxx_linux-64              7.2.0                        26    defaults
idna                      2.6              py36h82fb2a8_1    defaults
ipython_genutils          0.2.0            py36hb52b0d5_0    defaults
jinja2                    2.10             py36ha16c418_0    defaults
jsonschema                2.6.0            py36h006f8b5_0    defaults
jupyter_core              4.4.0            py36h7c827e3_0    defaults
libcurl                   7.59.0               h1ad7b7a_0    defaults
libedit                   3.1.20170329         h6b74fdf_2    defaults
libffi                    3.2.1                hd88cf55_4    defaults
libgcc-ng                 7.2.0                hdf63c60_3    defaults
libssh2                   1.8.0                h9cfc8f7_4    defaults
libstdcxx-ng              7.2.0                hdf63c60_3    defaults
markupsafe                1.0              py36hd9260cd_1    defaults
nbformat                  4.4.0            py36h31c9010_0    defaults
ncurses                   6.1                  hf484d3e_0    defaults
openssl                   1.0.2o               h20670df_0    defaults
patchelf                  0.9                  hf79760b_2    defaults
perl                      5.26.0               hae598fd_0    defaults
pip                       10.0.1                   py36_0    defaults
pkginfo                   1.4.2                    py36_1    defaults
psutil                    5.4.5            py36h14c3975_0    defaults
pycosat                   0.6.3            py36h0a5515d_0    defaults
pycparser                 2.18             py36hf9f622e_1    defaults
pyopenssl                 17.5.0           py36h20ba746_0    defaults
pysocks                   1.6.8                    py36_0    defaults
python                    3.6.5                hc3d631a_2    defaults
python-dateutil           2.7.2                    py36_0    defaults
pytz                      2018.4                   py36_0    defaults
pyyaml                    3.12             py36hafb9ca4_1    defaults
readline                  7.0                  ha6073c6_4    defaults
requests                  2.18.4           py36he2e5f8d_1    defaults
ruamel_yaml               0.15.35          py36h14c3975_1    defaults
setuptools                39.1.0                   py36_0    defaults
six                       1.11.0           py36h372c433_1    defaults
sqlite                    3.23.1               he433501_0    defaults
tk                        8.6.7                hc745277_3    defaults
traitlets                 4.3.2            py36h674d592_0    defaults
urllib3                   1.22             py36hbe7ace6_0    defaults
wheel                     0.31.0                   py36_0    defaults
xz                        5.2.3                h5e939de_4    defaults
yaml                      0.1.7                had09818_2    defaults
zlib                      1.2.11               ha838bed_2    defaults
```
</p></details>

Typo in channel name generates application error report
<!--
Hi!  Read this; it's important.

This is an issue tracker for conda -- the package manager.  File feature requests
for conda here, as well as bug reports about something conda has messed up.

If your issue is a bug report or feature request for:
  * a specific conda package from Anaconda ('defaults' channel):
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * a specific conda package from conda-forge:
      ==> file at the corresponding feedstock under https://github.com/conda-forge
  * repo.anaconda.com access and service:
      ==> file at https://github.com/ContinuumIO/anaconda-issues
  * anaconda.org access and service:
      ==> file at https://anaconda.org/contact/report
  * commands under 'conda build':
      ==> file at https://github.com/conda/conda-build
  * commands under 'conda env':
      ==> please file it here!
  * all other conda commands that start with 'conda':
      ==> please file it here!

If you continue on, and especially if you are submitting a bug report,

   **please include all requested information below.**

If a maintainer determines the information is required to understand 
your issue, and if it is not provided, your issue may be
closed automatically.

-->

**I'm submitting a...**
  - [x] bug report
  - [ ] feature request


## Current Behavior
<!-- What actually happens?
     If you want to include console output, please use "Steps to Reproduce" below. -->

Conda throws CondaHTTPError and also states the problem.

### Steps to Reproduce
<!-- If the current behavior is a bug, please provide specific, minimal steps to independently reproduce.
     Include the exact conda commands that reproduce the issue and their output between the ticks below. -->
```
[root@1fd6151b88ea ~]# conda install -c defautls conda-build
Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

`$ /opt/conda/bin/conda install -c defautls conda-build`

  environment variables:
                 CIO_TEST=<not set>
               CONDA_ROOT=/opt/conda
                     PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin
                          :/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : None
       user config file : /root/.condarc
 populated config files : /root/.condarc
          conda version : 4.5.4
    conda-build version : 3.10.2
         python version : 3.6.5.final.0
       base environment : /opt/conda  (writable)
           channel URLs : https://conda.anaconda.org/defautls/linux-64
                          https://conda.anaconda.org/defautls/noarch
                          https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /opt/conda/pkgs
                          /root/.conda/pkgs
       envs directories : /opt/conda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12
                UID:GID : 0:0
             netrc file : None
           offline mode : False


V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V V

CondaHTTPError: HTTP 404 NOT FOUND for url <https://conda.anaconda.org/defautls/noarch/repodata.json>
Elapsed: 00:00.063091
CF-RAY: 4258625a0ae3592d-DFW

The remote server could not find the noarch directory for the
requested channel with url: https://conda.anaconda.org/defautls

As of conda 4.3, a valid channel must contain a `noarch/repodata.json` and
associated `noarch/repodata.json.bz2` file, even if `noarch/repodata.json` is
empty. please request that the channel administrator create
`noarch/repodata.json` and associated `noarch/repodata.json.bz2` files.
$ mkdir noarch
$ echo '{}' > noarch/repodata.json
$ bzip2 -k noarch/repodata.json

You will need to adjust your conda configuration to proceed.
Use `conda config --show channels` to view your configuration's current state.
Further configuration help can be found at <https://conda.io/docs/config.html>.

A reportable application error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]: 
No report sent. To permanently opt-out, use

    $ conda config --set report_errors false
```


## Expected Behavior
<!-- What do you think should happen? -->
Conda shouldn't generate a report. It's the end user's fault, not a fault in conda. It should handle the scenario nicely.

## Environment Information
<details open><summary><code>`conda info`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda info' -->

```
[root@1fd6151b88ea ~]# conda info

     active environment : None
       user config file : /root/.condarc
 populated config files : /root/.condarc
          conda version : 4.5.4
    conda-build version : 3.10.2
         python version : 3.6.5.final.0
       base environment : /opt/conda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /opt/conda/pkgs
                          /root/.conda/pkgs
       envs directories : /opt/conda/envs
                          /root/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Linux/3.10.0-693.5.2.el7.x86_64 centos/6.9 glibc/2.12
                UID:GID : 0:0
             netrc file : None
           offline mode : False
```
</p></details>


<details open><summary><code>`conda config --show-sources`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda config --show-sources' -->

```
[root@1fd6151b88ea ~]# conda config --show-sources
==> /root/.condarc <==
add_pip_as_python_dependency: False
show_channel_urls: True
```
</p></details>


<details><summary><code>`conda list --show-channel-urls`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda list --show-channel-urls' -->

```
[root@1fd6151b88ea ~]# conda list --show-channel-url
# packages in environment at /opt/conda:
#
# Name                    Version                   Build  Channel
anaconda-client           1.6.14                   py36_0    defaults
asn1crypto                0.24.0                   py36_0    defaults
beautifulsoup4            4.6.0            py36h49b8c8c_1    defaults
binutils_impl_linux-64    2.28.1               had2808c_3    defaults
binutils_linux-64         7.2.0                        26    defaults
ca-certificates           2018.03.07                    0    defaults
certifi                   2018.4.16                py36_0    defaults
cffi                      1.11.5           py36h9745a5d_0    defaults
chardet                   3.0.4            py36h0f667ec_1    defaults
clyent                    1.2.2            py36h7e57e65_1    defaults
conda                     4.5.4                    py36_0    defaults
conda-build               3.10.2                   py36_0    defaults
conda-concourse-ci        0.1.0                     <pip>
conda-env                 2.6.0                h36134e3_1    defaults
conda-verify              2.0.0            py36h98955d8_0    defaults
cryptography              2.2.2            py36h14c3975_0    defaults
curl                      7.59.0               h84994c4_0    defaults
decorator                 4.3.0                    py36_0    defaults
expat                     2.2.5                he0dffb1_0    defaults
filelock                  3.0.4                    py36_0    defaults
gcc_impl_linux-64         7.2.0                habb00fd_3    defaults
gcc_linux-64              7.2.0                        26    defaults
git                       2.17.0          pl526hb75a9fb_0    defaults
glob2                     0.6              py36he249c77_0    defaults
gxx_impl_linux-64         7.2.0                hdf63c60_3    defaults
gxx_linux-64              7.2.0                        26    defaults
idna                      2.6              py36h82fb2a8_1    defaults
ipython_genutils          0.2.0            py36hb52b0d5_0    defaults
jinja2                    2.10             py36ha16c418_0    defaults
jsonschema                2.6.0            py36h006f8b5_0    defaults
jupyter_core              4.4.0            py36h7c827e3_0    defaults
libcurl                   7.59.0               h1ad7b7a_0    defaults
libedit                   3.1.20170329         h6b74fdf_2    defaults
libffi                    3.2.1                hd88cf55_4    defaults
libgcc-ng                 7.2.0                hdf63c60_3    defaults
libssh2                   1.8.0                h9cfc8f7_4    defaults
libstdcxx-ng              7.2.0                hdf63c60_3    defaults
markupsafe                1.0              py36hd9260cd_1    defaults
nbformat                  4.4.0            py36h31c9010_0    defaults
ncurses                   6.1                  hf484d3e_0    defaults
openssl                   1.0.2o               h20670df_0    defaults
patchelf                  0.9                  hf79760b_2    defaults
perl                      5.26.0               hae598fd_0    defaults
pip                       10.0.1                   py36_0    defaults
pkginfo                   1.4.2                    py36_1    defaults
psutil                    5.4.5            py36h14c3975_0    defaults
pycosat                   0.6.3            py36h0a5515d_0    defaults
pycparser                 2.18             py36hf9f622e_1    defaults
pyopenssl                 17.5.0           py36h20ba746_0    defaults
pysocks                   1.6.8                    py36_0    defaults
python                    3.6.5                hc3d631a_2    defaults
python-dateutil           2.7.2                    py36_0    defaults
pytz                      2018.4                   py36_0    defaults
pyyaml                    3.12             py36hafb9ca4_1    defaults
readline                  7.0                  ha6073c6_4    defaults
requests                  2.18.4           py36he2e5f8d_1    defaults
ruamel_yaml               0.15.35          py36h14c3975_1    defaults
setuptools                39.1.0                   py36_0    defaults
six                       1.11.0           py36h372c433_1    defaults
sqlite                    3.23.1               he433501_0    defaults
tk                        8.6.7                hc745277_3    defaults
traitlets                 4.3.2            py36h674d592_0    defaults
urllib3                   1.22             py36hbe7ace6_0    defaults
wheel                     0.31.0                   py36_0    defaults
xz                        5.2.3                h5e939de_4    defaults
yaml                      0.1.7                had09818_2    defaults
zlib                      1.2.11               ha838bed_2    defaults
```
</p></details>



Discussion:

Resolving patch:
diff --git a/conda/__init__.py b/conda/__init__.py
--- a/conda/__init__.py
+++ b/conda/__init__.py
@@ -33,6 +33,7 @@
 
 class CondaError(Exception):
     return_code = 1
+    reportable = False  # Exception may be reported to core maintainers
 
     def __init__(self, message, caused_by=None, **kwargs):
         self.message = message
diff --git a/conda/exceptions.py b/conda/exceptions.py
--- a/conda/exceptions.py
+++ b/conda/exceptions.py
@@ -790,9 +790,9 @@ def print_conda_exception(exc_val, exc_tb=None):
     if context.debug or context.verbosity > 0:
         sys.stderr.write(_format_exc(exc_val, exc_tb))
         sys.stderr.write('\n')
-    elif context.json:
+    elif context.json and exc_val.return_code:
         import json
-        stdoutlog = getLogger('conda.stdout')
+        stdoutlog = getLogger('conda.stdout' if exc_val.return_code else 'conda.stderr')
         exc_json = json.dumps(exc_val.dump_map(), indent=2, sort_keys=True, cls=EntityEncoder)
         stdoutlog.info("%s\n" % exc_json)
     else:
@@ -842,13 +842,11 @@ def error_upload_url(self):
         return context.error_upload_url
 
     def handle_exception(self, exc_val, exc_tb):
-        return_code = getattr(exc_val, 'return_code', None)
-        if return_code == 0:
-            return 0
-        if isinstance(exc_val, CondaHTTPError):
-            return self.handle_reportable_application_exception(exc_val, exc_tb)
         if isinstance(exc_val, CondaError):
-            return self.handle_application_exception(exc_val, exc_tb)
+            if exc_val.reportable:
+                return self.handle_reportable_application_exception(exc_val, exc_tb)
+            else:
+                return self.handle_application_exception(exc_val, exc_tb)
         if isinstance(exc_val, UnicodeError) and PY2:
             return self.handle_application_exception(EncodingError(exc_val), exc_tb)
         if isinstance(exc_val, EnvironmentError):
@@ -865,8 +863,7 @@ def handle_exception(self, exc_val, exc_tb):
 
     def handle_application_exception(self, exc_val, exc_tb):
         self._print_conda_exception(exc_val, exc_tb)
-        rc = getattr(exc_val, 'return_code', None)
-        return rc if rc is not None else 1
+        return exc_val.return_code
 
     def _print_conda_exception(self, exc_val, exc_tb):
         print_conda_exception(exc_val, exc_tb)
@@ -893,8 +890,7 @@ def handle_reportable_application_exception(self, exc_val, exc_tb):
         if do_upload:
             self._execute_upload(error_report)
         self.print_upload_confirm(do_upload, ask_for_upload, ask_response)
-        rc = getattr(exc_val, 'return_code', None)
-        return rc if rc is not None else 1
+        return exc_val.return_code
 
     def get_error_report(self, exc_val, exc_tb):
         command = ' '.join(ensure_text_type(s) for s in sys.argv)
diff --git a/conda/gateways/connection/__init__.py b/conda/gateways/connection/__init__.py
--- a/conda/gateways/connection/__init__.py
+++ b/conda/gateways/connection/__init__.py
@@ -1,5 +1,13 @@
 # -*- coding: utf-8 -*-
 from __future__ import absolute_import, division, print_function, unicode_literals
+from functools import partial
+
+def should_bypass_proxies_patched(should_bypass_proxies_func, url, no_proxy):
+    # Monkey patch requests, per https://github.com/requests/requests/pull/4723
+    if url.startswith("file://"):
+        return True
+    return should_bypass_proxies_func(url, no_proxy)
+
 
 try:
     from requests import ConnectionError, HTTPError, Session
@@ -12,6 +20,12 @@
     from requests.packages.urllib3.exceptions import InsecureRequestWarning
     from requests.structures import CaseInsensitiveDict
     from requests.utils import get_auth_from_url, get_netrc_auth
+
+    # monkeypatch requests
+    from requests.utils import should_bypass_proxies
+    import requests.utils
+    requests.utils.should_bypass_proxies = partial(should_bypass_proxies_patched,
+                                                   should_bypass_proxies)
 except ImportError:  # pragma: no cover
     from pip._vendor.requests import ConnectionError, HTTPError, Session
     from pip._vendor.requests.adapters import BaseAdapter, HTTPAdapter
@@ -24,6 +38,13 @@
     from pip._vendor.requests.structures import CaseInsensitiveDict
     from pip._vendor.requests.utils import get_auth_from_url, get_netrc_auth
 
+    # monkeypatch requests
+    from pip._vendor.requests.utils import should_bypass_proxies
+    import requests.utils
+    requests.utils.should_bypass_proxies = partial(should_bypass_proxies_patched,
+                                                   should_bypass_proxies)
+
+
 dispatch_hook = dispatch_hook
 BaseAdapter = BaseAdapter
 Response = Response


Test patch:
diff --git a/tests/test_create.py b/tests/test_create.py
--- a/tests/test_create.py
+++ b/tests/test_create.py
@@ -401,7 +401,6 @@ def assert_json_parsable(content):
 
             stdout, stderr = run_command(Commands.CREATE, prefix, "python=3.5 --json --dry-run", use_exception_handler=True)
             assert_json_parsable(stdout)
-            assert not stderr
 
             # regression test for #5825
             # contents of LINK and UNLINK is expected to have Dist format
@@ -1171,7 +1170,6 @@ def test_create_dry_run_json(self):
         with pytest.raises(DryRunExit):
             run_command(Commands.CREATE, prefix, "flask", "--dry-run", "--json")
         stdout, stderr = run_command(Commands.CREATE, prefix, "flask", "--dry-run", "--json", use_exception_handler=True)
-
         loaded = json.loads(stdout)
         names = set(d['name'] for d in loaded['actions']['LINK'])
         assert "python" in names