Repository: conda/conda

Issue:
https proxy username/password
I have installed anaconda using the command "bash Anaconda-2.3.0-Linux-x86_64.sh" and gave path of bin/conda to .bashrc and default it asks for bin path prepending which I gave, after closing and then running terminal I ran:
conda create -n dato-env python=2.7
which requires https proxy unsername and password for metadata, following is the error:
Password:
An unexpected error has occurred, please consider sending the
following traceback to the conda GitHub issue tracker at:

```
https://github.com/conda/conda/issues
```

Include the output of the command 'conda info' in your report.

Traceback (most recent call last):
  File "/home/mayank/anaconda/bin/conda", line 5, in <module>
    sys.exit(main())
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 201, in main
    args_func(args, p)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 208, in args_func
    args.func(args, p)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/cli/common.py", line 612, in inner
    return func(args, parser)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 50, in execute
    install.install(args, parser, 'create')
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 255, in install
    offline=args.offline)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/cli/common.py", line 549, in get_index_trap
    return get_index(_args, *_kwargs)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/api.py", line 42, in get_index
    unknown=unknown)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/utils.py", line 119, in **call**
    value = self.func(_args, *_kw)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 255, in fetch_index
    reversed(channel_urls))
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 254, in <lambda>
    use_cache=use_cache, session=session)),
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 65, in func
    res = f(_args, *_kwargs)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 154, in fetch_repodata
    handle_proxy_407(url, session)
  File "/home/mayank/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 184, in handle_proxy_407
    session.proxies[scheme], username, passwd)
KeyError: 'https'

Can you please help in this regard



Discussion:
Can you paste the output of `conda info` here?

Sure. Output of conda info:
Current conda install:

```
         platform : linux-64
    conda version : 3.14.1
```

  conda-build version : 1.14.1
       python version : 2.7.10.final.0
     requests version : 2.7.0
     root environment : /home/mayank/anaconda  (writable)
  default environment : /home/mayank/anaconda
     envs directories : /home/mayank/anaconda/envs
        package cache : /home/mayank/anaconda/pkgs
         channel URLs : https://repo.continuum.io/pkgs/free/linux-64/
                        https://repo.continuum.io/pkgs/free/noarch/
                        https://repo.continuum.io/pkgs/pro/linux-64/
                        https://repo.continuum.io/pkgs/pro/noarch/
          config file : None
    is foreign system : False


Resolving patch:
diff --git a/conda/fetch.py b/conda/fetch.py
--- a/conda/fetch.py
+++ b/conda/fetch.py
@@ -185,6 +185,10 @@ def handle_proxy_407(url, session):
     # We could also use HTTPProxyAuth, but this does not work with https
     # proxies (see https://github.com/kennethreitz/requests/issues/2061).
     scheme = requests.packages.urllib3.util.url.parse_url(url).scheme
+    if scheme not in session.proxies:
+        sys.exit("""Could not find a proxy for %r. See
+http://conda.pydata.org/docs/config.html#configure-conda-for-use-behind-a-proxy-server
+for more information on how to configure proxies.""" % scheme)
     username, passwd = get_proxy_username_and_pass(scheme)
     session.proxies[scheme] = add_username_and_pass_to_url(
                            session.proxies[scheme], username, passwd)


Test patch: