Repository: conda/conda

Issue:
Error while installing packages from conda-forge or other channels
Hi this issue has been reported initially on conda-forge, but seems to be a general conda problem:

https://github.com/conda-forge/conda-forge.github.io/issues/226

Briefly, on a Mac OS X, I get an error "UNAUTHORIZED" error message when installing packages from anaconda cloud channels, in particular conda-forge and my own channel tritemio.

For example (with conda-forge in `.condarc`) I get this error:

```
$ conda install phconvert
Using Anaconda API: https://api.anaconda.org
Fetching package metadata ......Warning: you may need to login to anaconda.org again with 'anaconda login' to access private packages(https://conda.anaconda.org/t/<TOKEN>/conda-forge/osx-64/, 401 Client Error: UNAUTHORIZED for url: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/osx-64/repodata.json)Warning: you may need to login to anaconda.org again with 'anaconda login' to access private packages(https://conda.anaconda.org/t/<TOKEN>/conda-forge/noarch/, 401 Client Error: UNAUTHORIZED for url: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/noarch/repodata.json).....
Solving package specifications: ..........

Package plan for installation in environment /Users/anto/miniconda3:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    phconvert-0.7              |           py35_0         213 KB  conda-forge

The following NEW packages will be INSTALLED:

    future:    0.15.2-py35_0                  
    hdf5:      1.8.17-1                       
    numexpr:   2.6.1-np111py35_0              
    phconvert: 0.7-py35_0          conda-forge
    pytables:  3.2.3.1-np111py35_0            

Proceed ([y]/n)? 

Fetching packages ...
Error: HTTPError: 401 Client Error: UNAUTHORIZED for url: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/osx-64/phconvert-0.7-py35_0.tar.bz2: https://conda.anaconda.org/t/tr-61d09b16-e11e-4d45-a499-f2ee3e7a348f/conda-forge/osx-64/phconvert-0.7-py35_0.tar.bz2

$ 
```

I get a similar error when trying to install phconvert from my own channel which used to work (the last release is several months old).

I even tried reinstalling miniconda but I still get the same error. Please refer to the original issue for more details.



Discussion:
Logging out from anaconda cloud with `anaconda-client` solves the issue:

```
$ anaconda logout
```

Weird that conda installation was so badly broken due to the unrelated login used to **upload** the packages.

cc @pmlandwehr

I believe this is fixed as of conda `4.2.11`.  Can anybody associated with this ticket help verify?

@tritemio @jakirkham @pmlandwehr

If conda 4.2.11 is in the default channels yet, it will be sometime tomorrow.  Someone from conda-forge will need to merge https://github.com/conda-forge/conda-feedstock/pull/6.

conda 4.2.11 doesn't work for a conda-forge instsll on a Mac for me:

```

$ conda --version
conda 4.2.11
$ conda install --channel conda-forge ulmo 
Fetching package metadata .......

CondaHTTPError: HTTP 401 UNAUTHORIZED
for url <https://conda.anaconda.org/t/dr-98f97490-dba1-424f-8887-0c26a10ab64c/conda-forge/osx-64/repodata.json>

The remote server has indicated you are using invalid credentials for this channel.

If the remote site is anaconda.org or follows the Anaconda Server API, you
will need to
  (a) login to the site with `anaconda login`, or
  (b) provide conda with a valid token directly.

Further configuration help can be found at <http://conda.pydata.org/docs/config.html>.



$ anaconda whoami
Using Anaconda API: https://api.anaconda.org
Username: drf5n
Member since: Sat Jun 13 10:01:53 2015
  +name: David Forrest
  +url: http://www.vims.edu/~drf
  +company: VIMS
  +user_type: user
  +location: USA
  +description: 
$ anaconda logout
Using Anaconda API: https://api.anaconda.org
logout successful
$ conda install --channel conda-forge ulmo 
Fetching package metadata .......

CondaHTTPError: HTTP 401 UNAUTHORIZED
for url <https://conda.anaconda.org/conda-forge/osx-64/repodata.json>

The remote server has indicated you are using invalid credentials for this channel.

If the remote site is anaconda.org or follows the Anaconda Server API, you
will need to
  (a) login to the site with `anaconda login`, or
  (b) provide conda with a valid token directly.

Further configuration help can be found at <http://conda.pydata.org/docs/config.html>.



$ anaconda login
Using Anaconda API: https://api.anaconda.org
Username: drf5n
drf5n's Password: 
login successful
$ anaconda whoami
Using Anaconda API: https://api.anaconda.org
Username: drf5n
Member since: Sat Jun 13 10:01:53 2015
  +name: David Forrest
  +url: http://www.vims.edu/~drf
  +company: VIMS
  +user_type: user
  +location: USA
  +description: 
$ conda install --channel conda-forge ulmo 
Fetching package metadata .......

CondaHTTPError: HTTP 401 UNAUTHORIZED
for url <https://conda.anaconda.org/t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/osx-64/repodata.json>

The remote server has indicated you are using invalid credentials for this channel.

If the remote site is anaconda.org or follows the Anaconda Server API, you
will need to
  (a) login to the site with `anaconda login`, or
  (b) provide conda with a valid token directly.

Further configuration help can be found at <http://conda.pydata.org/docs/config.html>.



$ 

```

and

```
$ conda install --channel conda-forge ulmo -vv
DEBUG conda.cli.main:_main(143): verbosity set to 2
DEBUG conda.common.url:path_to_url(36): /Users/drf/anaconda/conda-bld converted to file:///Users/drf/anaconda/conda-bld
DEBUG conda.fetch:fetch_index(288): channel_urls=OrderedDict([(u'https://conda.anaconda.org/conda-forge/osx-64', (u'conda-forge', 0)), (u'https://conda.anaconda.org/conda-forge/noarch', (u'conda-forge', 0)), (u'https://repo.continuum.io/pkgs/free/osx-64', (u'defaults', 1)), (u'https://repo.continuum.io/pkgs/free/noarch', (u'defaults', 1)), (u'https://repo.continuum.io/pkgs/pro/osx-64', (u'defaults', 1)), (u'https://repo.continuum.io/pkgs/pro/noarch', (u'defaults', 1))])
Fetching package metadata ...DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None)
DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None)
DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None)
DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://conda.anaconda.org/conda-forge/noarch at /Users/drf/anaconda/pkgs/cache/36521c4e.json
DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None)
DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://conda.anaconda.org/conda-forge/osx-64 at /Users/drf/anaconda/pkgs/cache/fdfa8174.json
DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/free/osx-64 at /Users/drf/anaconda/pkgs/cache/840cf1fb.json
DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None)
DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/free/noarch at /Users/drf/anaconda/pkgs/cache/524e4676.json
DEBUG requests.packages.urllib3.util.retry:from_int(155): Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=None)
DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/pro/osx-64 at /Users/drf/anaconda/pkgs/cache/ad7eda34.json
DEBUG conda.fetch:fetch_repodata(86): Opening repodata cache for https://repo.continuum.io/pkgs/pro/noarch at /Users/drf/anaconda/pkgs/cache/f1a0ac49.json
DEBUG conda.connection:add_binstar_token(138): Adding anaconda token for url <https://conda.anaconda.org/conda-forge/osx-64/repodata.json>
DEBUG conda.connection:add_binstar_token(138): Adding anaconda token for url <https://conda.anaconda.org/conda-forge/noarch/repodata.json>
INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io
INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io
INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): conda.anaconda.org
INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io
INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): repo.continuum.io
INFO requests.packages.urllib3.connectionpool:_new_conn(735): Starting new HTTPS connection (1): conda.anaconda.org
DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/free/osx-64/repodata.json.bz2 HTTP/1.1" 304 0
DEBUG conda.fetch:fetch_repodata(118): 
> GET /pkgs/free/osx-64/repodata.json.bz2 HTTPS
> User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5
> Accept: */*
> Accept-Encoding: identity
> Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ==
> Connection: keep-alive
> If-Modified-Since: Fri, 28 Oct 2016 20:51:24 GMT
> If-None-Match: "5813ba4c-4f0de"

< HTTPS 304 Not Modified
> cache-control: public, max-age=300
> cf-cache-status: HIT
> cf-ray: 2fa8d7673b0f0f09-IAD
> connection: keep-alive
> date: Mon, 31 Oct 2016 17:31:34 GMT
> etag: "5813ba4c-4f0de"
> expires: Mon, 31 Oct 2016 17:36:34 GMT
> last-modified: Fri, 28 Oct 2016 20:51:24 GMT
> server: cloudflare-nginx
> set-cookie: __cfduid=d08ad45dbc453138385fe3ec96ec5a9001477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly
> vary: Accept-Encoding


DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/pro/noarch/repodata.json.bz2 HTTP/1.1" 304 0
DEBUG conda.fetch:fetch_repodata(118): 
> GET /pkgs/pro/noarch/repodata.json.bz2 HTTPS
> User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5
> Accept: */*
> Accept-Encoding: identity
> Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ==
> Connection: keep-alive
> If-Modified-Since: Fri, 12 Feb 2016 07:52:34 GMT
> If-None-Match: "56bd8f42-46"

< HTTPS 304 Not Modified
> cache-control: public, max-age=300
> cf-cache-status: HIT
> cf-ray: 2fa8d7673e03575f-IAD
> connection: keep-alive
> date: Mon, 31 Oct 2016 17:31:34 GMT
> etag: "56bd8f42-46"
> expires: Mon, 31 Oct 2016 17:36:34 GMT
> last-modified: Fri, 12 Feb 2016 07:52:34 GMT
> server: cloudflare-nginx
> set-cookie: __cfduid=d3d85e68622468914e3fa715e3709ce321477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly
> vary: Accept-Encoding


DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/free/noarch/repodata.json.bz2 HTTP/1.1" 304 0
DEBUG conda.fetch:fetch_repodata(118): 
> GET /pkgs/free/noarch/repodata.json.bz2 HTTPS
> User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5
> Accept: */*
> Accept-Encoding: identity
> Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ==
> Connection: keep-alive
> If-Modified-Since: Wed, 19 Oct 2016 01:33:38 GMT
> If-None-Match: "5806cd72-3f4"

< HTTPS 304 Not Modified
> cache-control: public, max-age=300
> cf-cache-status: HIT
> cf-ray: 2fa8d767592023c0-IAD
> connection: keep-alive
> date: Mon, 31 Oct 2016 17:31:34 GMT
> etag: "5806cd72-3f4"
> expires: Mon, 31 Oct 2016 17:36:34 GMT
> last-modified: Wed, 19 Oct 2016 01:33:38 GMT
> server: cloudflare-nginx
> set-cookie: __cfduid=d75e78d2ca346a670c9077b17b491a6121477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly
> vary: Accept-Encoding


..DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /pkgs/pro/osx-64/repodata.json.bz2 HTTP/1.1" 304 0
DEBUG conda.fetch:fetch_repodata(118): 
> GET /pkgs/pro/osx-64/repodata.json.bz2 HTTPS
> User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5
> Accept: */*
> Accept-Encoding: identity
> Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ==
> Connection: keep-alive
> If-Modified-Since: Fri, 28 Oct 2016 20:51:35 GMT
> If-None-Match: "5813ba57-5659"

< HTTPS 304 Not Modified
> cache-control: public, max-age=300
> cf-cache-status: HIT
> cf-ray: 2fa8d767691056d5-IAD
> connection: keep-alive
> date: Mon, 31 Oct 2016 17:31:34 GMT
> etag: "5813ba57-5659"
> expires: Mon, 31 Oct 2016 17:36:34 GMT
> last-modified: Fri, 28 Oct 2016 20:51:35 GMT
> server: cloudflare-nginx
> set-cookie: __cfduid=daa252c17a691a76ac1ac6e937899e3171477935094; expires=Tue, 31-Oct-17 17:31:34 GMT; path=/; domain=.continuum.io; HttpOnly
> vary: Accept-Encoding


DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/noarch/repodata.json HTTP/1.1" 401 13
DEBUG conda.fetch:fetch_repodata(118): 
> GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/noarch/repodata.json HTTPS
> User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5
> Accept: */*
> Accept-Encoding: gzip, deflate, compress, identity
> Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ==
> Connection: keep-alive
> Content-Type: application/json

< HTTPS 401 UNAUTHORIZED
> connection: keep-alive
> content-length: 13
> content-type: text/html; charset=utf-8
> date: Mon, 31 Oct 2016 17:31:34 GMT
> license_expired: False
> license_valid: True
> server: nginx/1.10.1
> set-cookie: session=eyJfaWQiOnsiIGIiOiJZemsyWldSa01qVmtORGM0TTJVMVpXSXlPR1l5TmpZd05qazBaamN4WlRBPSJ9fQ.CvkRdg.yp1RWtljY2hKACm8gdiwyDrJ1ro; Domain=.anaconda.org; HttpOnly; Path=/

Invalid Token

DEBUG requests.packages.urllib3.connectionpool:_make_request(383): "GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/osx-64/repodata.json HTTP/1.1" 401 13
DEBUG conda.fetch:fetch_repodata(118): 
> GET /t/dr-0eb923a1-5cce-4961-856a-1b18e2a98a49/conda-forge/osx-64/repodata.json HTTPS
> User-Agent: conda/4.2.11 requests/2.7.0 CPython/2.7.11 Darwin/14.5.0 OSX/10.10.5
> Accept: */*
> Accept-Encoding: gzip, deflate, compress, identity
> Authorization: Basic YW5vbnltb3VzOnVzZXJAc2l0ZQ==
> Connection: keep-alive
> Content-Type: application/json

< HTTPS 401 UNAUTHORIZED
> connection: keep-alive
> content-length: 13
> content-type: text/html; charset=utf-8
> date: Mon, 31 Oct 2016 17:31:34 GMT
> license_expired: False
> license_valid: True
> server: nginx/1.10.1
> set-cookie: session=eyJfaWQiOnsiIGIiOiJZemsyWldSa01qVmtORGM0TTJVMVpXSXlPR1l5TmpZd05qazBaamN4WlRBPSJ9fQ.CvkRdg.yp1RWtljY2hKACm8gdiwyDrJ1ro; Domain=.anaconda.org; HttpOnly; Path=/

Invalid Token

..An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

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



INFO conda.common.io:captured(27): overtaking stderr and stdout
INFO conda.common.io:captured(33): stderr and stdout yielded back
Current conda install:

               platform : osx-64
          conda version : 4.2.11
       conda is private : False
      conda-env version : 4.2.11
    conda-build version : 1.14.1
         python version : 2.7.11.final.0
       requests version : 2.7.0
       root environment : /Users/drf/anaconda  (writable)
    default environment : /Users/drf/anaconda
       envs directories : /Users/drf/anaconda/envs
          package cache : /Users/drf/anaconda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : /Users/drf/.condarc
           offline mode : False



`$ /Users/drf/anaconda/bin/conda install --channel conda-forge ulmo -vv`




    Traceback (most recent call last):
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 479, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 145, in _main
        exit_code = args.func(args, p)
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/cli/main_install.py", line 80, in execute
        install(args, parser, 'install')
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 238, in install
        prefix=prefix)
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/api.py", line 24, in get_index
        index = fetch_index(channel_urls, use_cache=use_cache, unknown=unknown)
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 310, in fetch_index
        repodatas = [(u, f.result()) for u, f in zip(urls, futures)]
      File "/Users/drf/anaconda/lib/python2.7/site-packages/concurrent/futures/_base.py", line 403, in result
        return self.__get_result()
      File "/Users/drf/anaconda/lib/python2.7/site-packages/concurrent/futures/thread.py", line 55, in run
        result = self.fn(*self.args, **self.kwargs)
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 74, in func
        res = f(*args, **kwargs)
      File "/Users/drf/anaconda/lib/python2.7/site-packages/conda/fetch.py", line 220, in fetch_repodata
        e.response.reason)
    CondaHTTPError: HTTP 401 UNAUTHORIZED
    for url <https://conda.anaconda.org/t/<TOKEN>/conda-forge/osx-64/repodata.json>

    The remote server has indicated you are using invalid credentials for this channel.

    If the remote site is anaconda.org or follows the Anaconda Server API, you
    will need to
      (a) login to the site with `anaconda login`, or
      (b) provide conda with a valid token directly.

    Further configuration help can be found at <http://conda.pydata.org/docs/config.html>.


$ 

```

@kalefranz Steps to reproduce, using conda 4.2.13:

1. Anaconda3 on OS X, not logged in, just default channels
2. `conda config --add channels conda-forge`
3. `conda install ...` fails with 401 (or anything that hits channels like `search`)
4. `anaconda login`
5. `conda install ...` is ok
6. `anaconda logout`
7. `conda install ...` is ok

So it looks like going through the login cycle fixed the issue for me.
This fixed it for me:

```
anaconda logout
conda update conda
```

Strange.
This is still broken with conda 4.2.13.

I got the error trying to install with conda-forge  in my .condarc

`anaconda logout`

fixed it -- but I hadn't logged in / uploaded for ages, with multiple re-boots since.

Odd.

Anyway, if I'm just pulling from a public channel, any logging in should just be ignored, yes?


4.2.16 and 4.3.13 are the latest releases for the respective feature series. If this is still a problem in 4.3.13, then please let me know. 
> if I'm just pulling from a public channel, any logging in should just be ignored, yes?

I honestly don't remember exactly. It's an anaconda.org behavior, not a conda behavior necessarily. If the anaconda.org token is completely invalid, you might get this 401 behavior according to the current design. 

Also, there is no concept of a public vs private channel... Public vs private is on a per-package basis only. This causes a ton of confusion though and also a lot of extra logic in different places. I'd hope this could someday be changed to the channel either being accessible with the token or not, and not having the granular access where a package may be there with one token, but just "disappear" with another, even though the channel looks just fine because it otherwise contains packages. 
> there is no concept of a public vs private channel... Public vs private is on a per-package basis only. 

Ah, that does explain it. nevertheless, if one is only trying to access public packages, then login status should be ignored.

I just did a 'conda update conda` and got 4.2.13, and the problem still exists there.

I'm not sure how to install a newer one without risking hosing my current conda system....



I eventually gave up and hosed my system per https://github.com/conda/conda/issues/3780#issuecomment-264088686 

I had tried just moving anaconda out of the way and reinstalling a new full anaconda a few times, but it didn't fix things.  It was the miniconda overwrite that appeared to fix things up.
same problem with conda 4.3.8

@drf5n  I had the same problem as you
I followed all your advices still I can't download packages as I please... 
First I had the SSL problem, I changed the configuration using `conda config --set ssl_verify False` ; but then another error appeared: 

> CondaHTTPError: HTTP 403 None for url <None>
> The channel you requested is not available on the remote server.

I typed `logout anaconda`, then when I try to update conda I have the same error above...

I'm pretty desperate, I'm a statistician, signed on to be a data scientist, still, I spent more time dealing with the package installation process than dealing with actual data... Mayday please!

EDIT: 
@kalefranz  I meant `anaconda logout`

It's `anaconda logout`, not `logout Anaconda`.
No amount of logging in, logging out, upgrading, zapping .condarc, or anything else solved the problem for me. I finally moved my ~/anaconda3 directory out of the way, deleted ~/.condarc and ~/.conda, downloaded the Anaconda...sh file again, installed, created an environment, then tried the install again. It didn't matter if I was in an environment or not, the install command failed with the "not authorized" error.
I'm not at all sure what the miniconda installation ( https://conda.io/docs/install/quick.html#os-x-miniconda-install ) did, but that method of re-installing anaconda seemed to overwrite whatever it was that was outside the standard anaconda installation and correct the problem for me.
Tried that. No joy in Mudville with miniconda either.

I gave up and manually found the package I was interested in on anaconda.org, then downloaded and installed it. As you might imagine, this was a bit cumbersome, as I had to work out the dependencies myself.

my conda version is 4.3.8. all the time is http connection error.how to solve it?
@smontanaro I'd like to figure out what's going with your install.  There's obviously something laying around somewhere that's annoyingly sticky.  Hopefully for me (not for you), you're still having the problem and it's still reproducible...  If so,  can you give me the output of `conda config --show-sources`, and then `python -m conda.gateways.anaconda_client`?  Also, just so I have it, `conda info`.
I am indeed still getting the same 401 error.

Executing

`conda config --show-sources`

just prints a blank line.

I can't execute

`python -m conda.gateways.anaconda_client`

from my preferred environment, but I can execute it by specifying the path to Python explicitly. The output sure doesn't appear interesting to me:

```
% ~/anaconda3/bin/python -m conda.gateways.anaconda_client
{}
```
Here's the conda info output (again, run with an explicit path, outside any environment):

```
Current conda install:

               platform : linux-64
          conda version : 4.3.16
       conda is private : False
      conda-env version : 4.3.16
    conda-build version : 2.1.9
         python version : 3.6.0.final.0
       requests version : 2.13.0
       root environment : /home/skip/anaconda3  (writable)
    default environment : /home/skip/anaconda3
       envs directories : /home/skip/anaconda3/envs
                          /home/skip/.conda/envs
          package cache : /home/skip/anaconda3/pkgs
                          /home/skip/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
           offline mode : False
             user-agent : conda/4.3.16 requests/2.13.0 CPython/3.6.0 Linux/4.8.0-46-generic debian/stretch/sid glibc/2.24
                UID:GID : 1001:1001
```

I have no ~/.condarc file.

@kalefranz - any thoughts?
I've been having this problem too and have variously tried wiping everything multiple times (including just now with the latest versions of everything).  I found my .netrc file was probably interfering (seems like this is a bug in conda)

Do you have a .netrc file in your home directory?  I had created one a while back for a few machine specific logins, and among other things had added a default login anonymous... line.  Removing the default line in my .netrc file fixed it for me.  

(edit: note this was on a linux box not an mac, but I think conda is likely to use the .netrc file by accident on macos too)
Ah. Could be.  .netrc is something requests natively supports.  We tried removing support for .netrc files once, and a lot of other people also complained about that.
Yeah, I agree that you may want to allow netrc to be used too, but it would be nice to check for this, so that if there is a 401 error, you either (a) prompt the user that it could be their netrc, or (b) try again disabling it.  
The `conda info` and `conda config` commands could also probably be made aware of what requests sees. 

> On May 5, 2017, at 2:28 PM, Ethan Gutmann <notifications@github.com> wrote:
> 
> Yeah, I agree that you may want to allow netrc to be used too, but it would be nice to check for this, so that if there is a 401 error, you either (a) prompt the user that it could be their netrc, or (b) try again disabling it.
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.
> 


Resolving patch:
diff --git a/conda/cli/main_info.py b/conda/cli/main_info.py
--- a/conda/cli/main_info.py
+++ b/conda/cli/main_info.py
@@ -11,12 +11,12 @@
 from logging import getLogger
 import os
 from os import listdir
-from os.path import exists, expanduser, join
+from os.path import exists, expanduser, isfile, join
 import re
 import sys
 
 from .common import add_parser_json, add_parser_offline, arg2spec, handle_envs_list, stdout_json
-from ..common.compat import itervalues, on_win, iteritems
+from ..common.compat import iteritems, itervalues, on_win
 
 log = getLogger(__name__)
 
@@ -170,6 +170,11 @@ def get_info_dict(system=False):
 
     try:
         from requests import __version__ as requests_version
+        # These environment variables can influence requests' behavior, along with configuration
+        # in a .netrc file
+        #   REQUESTS_CA_BUNDLE
+        #   HTTP_PROXY
+        #   HTTPS_PROXY
     except ImportError:
         requests_version = "could not import"
     except Exception as e:
@@ -199,6 +204,12 @@ def get_info_dict(system=False):
                     for c in channels]
     channels = [mask_anaconda_token(c) for c in channels]
 
+    netrc_file = os.environ.get('NETRC')
+    if not netrc_file:
+        user_netrc = expanduser("~/.netrc")
+        if isfile(user_netrc):
+            netrc_file = user_netrc
+
     info_dict = dict(
         platform=context.subdir,
         conda_version=conda_version,
@@ -222,6 +233,7 @@ def get_info_dict(system=False):
         requests_version=requests_version,
         user_agent=user_agent,
         conda_location=CONDA_PACKAGE_ROOT,
+        netrc_file=netrc_file,
     )
     if on_win:
         from ..common.platform import is_admin_on_windows
@@ -274,6 +286,7 @@ def get_main_info_str(info_dict):
               package cache : %(_pkgs_dirs)s
                channel URLs : %(_channels)s
                 config file : %(rc_path)s
+                 netrc file : %(netrc_file)s
                offline mode : %(offline)s
                  user-agent : %(user_agent)s\
     """) % info_dict)
diff --git a/conda/common/platform.py b/conda/common/platform.py
--- a/conda/common/platform.py
+++ b/conda/common/platform.py
@@ -20,10 +20,11 @@ def is_admin_on_windows():  # pragma: unix no cover
     try:
         from ctypes.windll.shell32 import IsUserAnAdmin
         return IsUserAnAdmin() != 0
-    except ImportError:
+    except ImportError as e:
+        log.debug('%r', e)
         return 'unknown'
     except Exception as e:
-        log.warn(repr(e))
+        log.warn('%r', e)
         return 'unknown'
 
 


Test patch: