Repository: conda/conda

Issue:
Cannot install packages
<!--
Hi!

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.continuum.io 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!

-->

**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. -->
I can no longer install any packages, neither from command line using conda install, nor from the anaconda navigator.
This issue occurs since I uninstalled spyder yesterday (I wanted to reinstall it to try to fix a different issue). Uninstallation was done via Anaconda navigator. 

### 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. -->
Here is one example, but happens with any package I've tried so far.
```
conda install python=2.7
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - python=2.7

Current channels:

  - https://repo.continuum.io/pkgs/main/osx-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/osx-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/osx-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/osx-64
  - https://repo.continuum.io/pkgs/pro/noarch
```



## Environment Information
Happens on all my environments, but here is one example

<details open><summary><code>`conda info`</code></summary><p>
<!-- between the ticks below, paste the output of 'conda info' -->

```
     active environment : base
    active env location : /Applications/anaconda
            shell level : 2
       user config file : /Users/dkleindienst/.condarc
 populated config files : /Users/dkleindienst/.condarc
          conda version : 4.4.8
    conda-build version : 1.8.2
         python version : 2.7.12.final.0
       base environment : /Applications/anaconda  (writable)
           channel URLs : https://repo.continuum.io/pkgs/main/osx-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/osx-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
          package cache : /Applications/anaconda/pkgs
                          /Users/dkleindienst/.conda/pkgs
       envs directories : /Applications/anaconda/envs
                          /Users/dkleindienst/.conda/envs
               platform : osx-64
             user-agent : conda/4.4.8 requests/2.14.2 CPython/2.7.12 Darwin/17.4.0 OSX/10.13.3
                UID:GID : 501:20
             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' -->

```
==> /Users/dkleindienst/.condarc <==
ssl_verify: True
channels:
  - defaults

```
</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' -->

```
# packages in environment at /Applications/anaconda:
#
# Name                    Version                   Build  Channel
_license                  1.1                      py27_1    defaults
abstract-rendering        0.5.1                np19py27_0    <unknown>
alabaster                 0.7.3                    py27_0    defaults
anaconda-client           1.6.3                    py27_0    defaults
anaconda-navigator        1.6.4                    py27_0    defaults
anaconda-project          0.6.0                    py27_0    defaults
appnope                   0.1.0                    py27_0    defaults
appscript                 1.0.1                    py27_0    defaults
argcomplete               0.8.4                    py27_0    defaults
asn1crypto                0.22.0                   py27_0    defaults
astroid                   1.4.7                    py27_0    defaults
astropy                   1.0.1                np19py27_0    defaults
atom                      0.3.9                    py27_0    <unknown>
babel                     1.3                      py27_0    defaults
backports                 1.0                      py27_0    defaults
bcolz                     0.8.1                np19py27_0    defaults
beautiful-soup            4.3.2                    py27_0    <unknown>
beautifulsoup4            4.6.0                    py27_0    defaults
binstar                   0.10.1                   py27_3    defaults
bitarray                  0.8.1                    py27_0    <unknown>
blaze                     0.6.3                np19py27_0    <unknown>
blaze-core                0.7.3                np19py27_0    defaults
blz                       0.6.2                np19py27_0    <unknown>
bokeh                     0.8.1                np19py27_1    defaults
boto                      2.36.0                   py27_0    defaults
casuarius                 1.1                      py27_0    <unknown>
cdecimal                  2.3                      py27_0    <unknown>
certifi                   14.05.14                 py27_0    defaults
cffi                      1.10.0                   py27_0    defaults
chaco                     4.4.1                np19py27_0    <unknown>
chardet                   3.0.4                    py27_0    defaults
clize                     3.0a2                     <pip>
cloudpickle               0.5.2                    py27_1    defaults
clyent                    1.2.2                    py27_0    defaults
colorama                  0.3.3                    py27_0    defaults
conda                     4.4.8                    py27_0    defaults
conda-build               1.8.2                    py27_0    <unknown>
conda-env                 2.6.0                h36134e3_0    defaults
configobj                 5.0.6                    py27_0    <unknown>
configparser              3.5.0                    py27_0    defaults
cryptography              1.8.1                    py27_0    defaults
curl                      7.38.0                        0    <unknown>
cycler                    0.10.0                   py27_0    defaults
cycler                    0.10.0                    <pip>
cython                    0.22                     py27_0    defaults
cytoolz                   0.7.2                    py27_0    defaults
datashape                 0.4.4                np19py27_1    defaults
dateutil                  2.1                      py27_2    <unknown>
decorator                 3.4.0                    py27_0    <unknown>
docutils                  0.12                     py27_0    <unknown>
dynd-python               0.6.5                np19py27_0    <unknown>
enable                    4.3.0                np19py27_2    <unknown>
enaml                     0.9.8                    py27_0    <unknown>
entrypoints               0.2.2                    py27_0    defaults
enum34                    1.1.6                    py27_0    defaults
fastcache                 1.0.2                    py27_0    defaults
flask                     0.10.1                   py27_1    <unknown>
freetype                  2.5.5                         1    defaults
funcsigs                  0.4                      py27_0    defaults
funcsigs                  0.4                       <pip>
future                    0.13.1                   py27_0    <unknown>
futures                   2.2.0                    py27_0    defaults
get_terminal_size         1.0.0                    py27_0    defaults
gevent                    1.0.1                    py27_0    <unknown>
gevent-websocket          0.9.3                    py27_0    <unknown>
glueviz                   0.4.0                np19py27_1    defaults
greenlet                  0.4.5                    py27_0    defaults
grin                      1.2.1                    py27_1    <unknown>
h5py                      2.4.0                np19py27_0    defaults
hdf5                      1.8.14                        0    defaults
icu                       54.1                          0    defaults
idna                      2.5                      py27_0    defaults
ipaddress                 1.0.18                   py27_0    defaults
ipykernel                 4.5.0                    py27_0    defaults
ipython                   5.1.0                    py27_0    defaults
ipython-qtconsole         3.0.0                    py27_0    defaults
ipython_genutils          0.1.0                    py27_0    defaults
itsdangerous              0.24                     py27_0    <unknown>
jbig                      2.1                           0    defaults
jdcal                     1.0                      py27_0    <unknown>
jedi                      0.10.2                   py27_2    defaults
jinja2                    2.8                      py27_1    defaults
jpeg                      8d                            2    defaults
jsonschema                2.4.0                    py27_0    defaults
jupyter_client            4.4.0                    py27_0    defaults
jupyter_core              4.2.0                    py27_0    defaults
kiwisolver                0.1.3                    py27_0    <unknown>
lazy-object-proxy         1.2.1                    py27_0    defaults
lcms                      1.19                          0    <unknown>
libdynd                   0.6.5                         0    <unknown>
libpng                    1.6.22                        0    defaults
libsodium                 0.4.5                         0    <unknown>
libtiff                   4.0.6                         2    defaults
libxml2                   2.9.0                         1    <unknown>
libxslt                   1.1.28                        2    <unknown>
llvm                      3.3                           0    <unknown>
llvmlite                  0.2.2                    py27_1    defaults
llvmpy                    0.12.7                   py27_0    <unknown>
lxml                      3.4.2                    py27_0    defaults
markupsafe                0.23                     py27_0    <unknown>
matplotlib                1.5.3                     <pip>
matplotlib                1.5.3               np111py27_1    defaults
mistune                   0.5.1                    py27_0    defaults
mkl                       11.3.3                        0    defaults
mock                      1.0.1                    py27_0    <unknown>
multipledispatch          0.4.7                    py27_0    <unknown>
nbconvert                 4.2.0                    py27_0    defaults
nbformat                  4.1.0                    py27_0    defaults
networkx                  1.9.1                    py27_0    <unknown>
networkx                  1.9.1                     <pip>
NEURON                    7.4                       <pip>
nltk                      3.0.2                np19py27_0    defaults
node-webkit               0.10.1                        0    <unknown>
nose                      1.3.4                    py27_1    defaults
numba                     0.17.0               np19py27_0    defaults
numexpr                   2.6.1               np111py27_1    defaults
numpy                     1.11.2                   py27_0    defaults
numpydoc                  0.6.0                    py27_0    defaults
oct2py                    3.1.0                     <pip>
odo                       0.3.1                np19py27_0    defaults
openpyxl                  1.8.5                    py27_0    <unknown>
openssl                   1.0.2j                        0    defaults
packaging                 16.8                     py27_0    defaults
pandas                    0.15.2               np19py27_1    defaults
path.py                   8.2.1                    py27_0    defaults
pathlib2                  2.1.0                    py27_0    defaults
patsy                     0.3.0                np19py27_0    <unknown>
pep8                      1.6.2                    py27_0    defaults
pexpect                   3.3                      py27_0    defaults
pickleshare               0.7.4                    py27_0    defaults
pil                       1.1.7                    py27_1    <unknown>
pillow                    3.4.1                    py27_0    defaults
pip                       7.1.2                     <pip>
pip                       8.1.2                    py27_0    defaults
pip                       9.0.1                     <pip>
plotly                    1.6.17                    <pip>
ply                       3.4                      py27_0    <unknown>
prompt_toolkit            1.0.3                    py27_0    defaults
psutil                    2.2.1                    py27_0    defaults
ptyprocess                0.4                      py27_0    defaults
py                        1.4.26                   py27_0    defaults
pyasn1                    0.1.7                    py27_0    defaults
pyaudio                   0.2.7                    py27_0    <unknown>
pyclips-1.0.7.348         clips_6.24                <pip>
pycodestyle               2.3.1                    py27_0    defaults
pycosat                   0.6.3            py27h6c51c7e_0    defaults
pycparser                 2.10                     py27_0    <unknown>
pycrypto                  2.6.1                    py27_0    <unknown>
pycurl                    7.19.5.1                 py27_0    defaults
pyface                    4.4.0                    py27_0    <unknown>
pyflakes                  0.8.1                    py27_0    defaults
pygments                  2.0.2                    py27_0    defaults
pylint                    1.5.4                    py27_1    defaults
pyopenssl                 17.0.0                   py27_0    defaults
pyparsing                 2.0.3                    py27_0    defaults
pyqt                      5.6.0                    py27_0    defaults
pytables                  3.1.1                np19py27_2    defaults
pytest                    2.6.4                    py27_0    defaults
python                    2.7.12                        1    defaults
python-dateutil           2.5.3                    py27_0    defaults
python.app                1.2                      py27_3    <unknown>
pytz                      2015.4                    <pip>
pytz                      2016.7                   py27_0    defaults
pyyaml                    3.12                     py27_0    defaults
pyzmq                     14.5.0                   py27_0    defaults
qt                        5.6.0                         0    defaults
qtawesome                 0.4.4                    py27_0    defaults
qtconsole                 4.2.1                    py27_1    defaults
qtpy                      1.3.1                    py27_0    defaults
readline                  6.2                           2    defaults
redis                     2.6.9                         0    <unknown>
redis-py                  2.10.3                   py27_0    defaults
requests                  2.7.0                     <pip>
requests                  2.14.2                   py27_0    defaults
rope                      0.9.4                    py27_1    <unknown>
rpy2                      2.5.6                     <pip>
ruamel_yaml               0.11.14                  py27_0    defaults
runipy                    0.1.3                    py27_0    defaults
scikit-image              0.11.2               np19py27_0    defaults
scikit-learn              0.18                np111py27_0    defaults
scipy                     0.18.1              np111py27_0    defaults
setuptools                27.2.0                   py27_0    defaults
Shapely                   1.4.1                     <pip>
simplegeneric             0.8.1                    py27_1    defaults
simpleitk                 0.10.0                   py27_0    simpleitk
sip                       4.18                     py27_0    defaults
six                       1.10.0                   py27_0    defaults
snowballstemmer           1.2.0                    py27_0    defaults
sockjs-tornado            1.0.1                    py27_0    <unknown>
sphinx                    1.2.3                    py27_0    defaults
sphinx_rtd_theme          0.1.7                    py27_0    defaults
sqlalchemy                0.9.9                    py27_0    defaults
sqlite                    3.13.0                        0    defaults
ssl_match_hostname        3.4.0.2                  py27_0    <unknown>
statsmodels               0.6.1                np19py27_0    defaults
supreme                   0.9                       <pip>
sympy                     0.7.6                    py27_0    defaults
terminado                 0.5                      py27_0    defaults
TiffCapture               0.1.4                     <pip>
tk                        8.5.18                        0    defaults
toolz                     0.7.1                    py27_0    defaults
tornado                   4.1                      py27_0    defaults
traitlets                 4.3.1                    py27_0    defaults
traits                    4.4.0                    py27_0    <unknown>
traitsui                  4.4.0                    py27_0    <unknown>
ujson                     1.33                     py27_0    <unknown>
unicodecsv                0.9.4                    py27_0    <unknown>
wcwidth                   0.1.7                    py27_0    defaults
werkzeug                  0.10.1                   py27_0    defaults
wheel                     0.29.0                   py27_0    defaults
wrapt                     1.10.8                   py27_0    defaults
xlrd                      0.9.3                    py27_0    <unknown>
xlsxwriter                0.6.7                    py27_0    defaults
xlwings                   0.3.4                    py27_0    defaults
xlwt                      0.7.5                    py27_0    <unknown>
xz                        5.2.2                         0    defaults
yaml                      0.1.6                         0    defaults
zeromq                    4.0.4                         0    defaults
zlib                      1.2.8                         3    defaults
```
</p></details>



Discussion:
I am also having the exact same problem. It just started this morning. 

```
bash-4.2$ conda create -p /tmp/foobar python=3.6
Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  - python=3.6

Current channels:

  - https://repo.continuum.io/pkgs/main/linux-64
  - https://repo.continuum.io/pkgs/main/noarch
  - 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
```
Can you provide the output of the command you're running, along with `-vv` ?
Same problem here (macOS high sierra, conda 4.4.6)
just noticed it today (as far as I can remember I didn't do any conda installs/uninstalls recently)

```
$ conda info
     active environment : None
       user config file : /Users/stefaan/.condarc
 populated config files : /Users/stefaan/.condarc
          conda version : 4.4.6
    conda-build version : 1.3.1
         python version : 2.7.12.final.0
       base environment : /Users/stefaan/usr/anaconda  (writable)
           channel URLs : https://repo.continuum.io/pkgs/main/osx-64
                          https://repo.continuum.io/pkgs/main/noarch
                          https://repo.continuum.io/pkgs/free/osx-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/osx-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/osx-64
                          https://repo.continuum.io/pkgs/pro/noarch
          package cache : /Users/stefaan/usr/anaconda/pkgs
                          /Users/stefaan/.conda/pkgs
       envs directories : /Users/stefaan/usr/anaconda/envs
                          /Users/stefaan/.conda/envs
               platform : osx-64
             user-agent : conda/4.4.6 requests/2.13.0 CPython/2.7.12 Darwin/17.4.0 OSX/10.13.3
                UID:GID : 501:20
             netrc file : None
           offline mode : False
```

even search doesn't work anymore:
```
$ conda search pandas
Loading channels: done

PackagesNotFoundError: The following packages are not available from current channels:

  - pandas

Current channels:

  - https://repo.continuum.io/pkgs/main/osx-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/osx-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/osx-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/osx-64
  - https://repo.continuum.io/pkgs/pro/noarch
```

trying to create new env with `-vv`:
```
$ conda create -vv -n tmp27 python=2.7
DEBUG conda.gateways.logging:set_verbosity(148): verbosity set to 2
DEBUG conda.core.package_cache:_check_writable(226): package cache directory '/Users/stefaan/usr/anaconda/pkgs' writable: True
Solving environment: ...working... DEBUG conda.core.solve:solve_final_state(140): solving prefix /Users/stefaan/usr/anaconda/envs/tmp27
  specs_to_remove: frozenset([])
  specs_to_add: frozenset([MatchSpec(name=LowerStrMatch('python'), version=VersionSpec('2.7.*'))])
  prune: False
DEBUG conda.core.package_cache:_check_writable(226): package cache directory '/Users/stefaan/.conda/pkgs' writable: True
DEBUG conda.resolve:bad_installed(707): Checking if the current environment is consistent
DEBUG conda.core.solve:solve_final_state(222): inconsistent dists: None
DEBUG conda.resolve:get_reduced_index(252): Retrieving packages for:
  - python=2.7
failed
Traceback (most recent call last):
  File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 724, in __call__
    return func(*args, **kwargs)
  File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main
    exit_code = do_call(args, p)
  File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 76, in do_call
    exit_code = getattr(module, func_name)(args, parser)
  File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 11, in execute
    install(args, parser, 'create')
  File "/Users/stefaan/usr/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 247, in install
    raise PackagesNotFoundError(e.bad_deps, channels_urls)
PackagesNotFoundError: The following packages are not available from current channels:

  - python=2.7

Current channels:

  - https://repo.continuum.io/pkgs/main/osx-64
  - https://repo.continuum.io/pkgs/main/noarch
  - https://repo.continuum.io/pkgs/free/osx-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/osx-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/osx-64
  - https://repo.continuum.io/pkgs/pro/noarch```
ok, I took a debugger and this is what I found on my setup after some digging around:

in `conda/core/repodata.py` around line 85 (`SubdirData.query_all`):
```
            from concurrent.futures import ThreadPoolExecutor, as_completed
            executor = ThreadPoolExecutor(10)
            futures = (executor.submit(
                SubdirData(Channel(url)).query, package_ref_or_match_spec
            ) for url in channel_urls)
            return tuple(concat(future.result() for future in as_completed(futures)))
```

Note that `futures` here is a generator expression. 
On my setup, `concurrent.futures.as_completed(fs)` assumes that `fs` is a sequence that can be iterated over multiple times, which does not work with a generator expression obviously.

`concurrent.futures` is since  version 3.0.0 (https://github.com/agronholm/pythonfutures/commit/f3d2563b4345b108a6197a36411aec19064ee15f)   is more flexible about this, but apparently my `conda` uses version 2.2.0 (I think, not completely sure about this)

The hack that fixes the situation for me is as follows.
In `${anaconda_install_dir}/lib/python2.7/site-packages/concurrent/futures/_base.py`, I updated (based on https://github.com/agronholm/pythonfutures/commit/f3d2563b4345b108a6197a36411aec19064ee15f) the `as_completed` function around line 200 so that `fs` is a set that can be iterated over multiple times:
```
def as_completed(fs, timeout=None):
    # ...

    fs = set(fs)
    with _AcquireFutures(fs):
        # ...
```


Now, `conda search pandas` and `conda create` work again for me as expected
Note: now that conda works again for me, I updated it to currently latest version 4.4.9 (`conda update conda`)

Also, I updated the `futures` package manually in my base install to properly get rid of my manual workaround
```
$ conda install futures
...
The following packages will be downloaded:
    package                    |            build
    ---------------------------|-----------------
    futures-3.2.0              |   py27h1b80678_0          24 KB  defaults

The following packages will be UPDATED:
    futures: 2.2.0-py27_0 defaults --> 3.2.0-py27h1b80678_0 defaults
```

Resolving patch:
diff --git a/conda/core/index.py b/conda/core/index.py
--- a/conda/core/index.py
+++ b/conda/core/index.py
@@ -182,7 +182,7 @@ def get_reduced_index(prefix, channels, subdirs, specs):
         pending_track_features = set()
 
         def query_all(spec):
-            futures = (executor.submit(sd.query, spec) for sd in subdir_datas)
+            futures = tuple(executor.submit(sd.query, spec) for sd in subdir_datas)
             return tuple(concat(future.result() for future in as_completed(futures)))
 
         def push_spec(spec):
diff --git a/conda/core/repodata.py b/conda/core/repodata.py
--- a/conda/core/repodata.py
+++ b/conda/core/repodata.py
@@ -80,7 +80,7 @@ def query_all(channels, subdirs, package_ref_or_match_spec):
         channel_urls = all_channel_urls(channels, subdirs=subdirs)
         check_whitelist(channel_urls)
         with ThreadLimitedThreadPoolExecutor() as executor:
-            futures = (executor.submit(
+            futures = tuple(executor.submit(
                 SubdirData(Channel(url)).query, package_ref_or_match_spec
             ) for url in channel_urls)
             return tuple(concat(future.result() for future in as_completed(futures)))


Test patch: