Repository: conda/conda

Issue:
Installation of local packages breaks conda 4.4.6
Not sure whether this is a duplicate of https://github.com/conda/conda/issues/6621

Apparently, installing local packages (such as `conda install <path-to-pkg.tar.bz2>`) breaks the conda environment with conda 4.4.6. Consider the following script that 

1. installs dask from the remote servers,
2. uninstalls it and 
3. installs it again from the local, downloaded package.

```bash
# install and activate miniconda
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
source $HOME/miniconda/bin/activate root
conda update conda -y

# install dask from remote servers
conda install dask -y

# now we uninstall dask and install it again from the file
conda uninstall dask --force -y
conda install ~/miniconda/pkgs/dask-0.*.tar.bz2

# now install any other package, e.g. anaconda-client
conda install anaconda-client   # fails!
```
The output of the last command is
```
Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

    Traceback (most recent call last):
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/exceptions.py", line 724, in __call__
        return func(*args, **kwargs)
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main
        exit_code = do_call(args, p)
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 76, in do_call
        exit_code = getattr(module, func_name)(args, parser)
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/main_install.py", line 11, in execute
        install(args, parser, 'install')
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install
        force_reinstall=context.force,
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction
        force_remove, force_reinstall)
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff
        final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in solve_final_state
        return IndexedSet(index[d] for d in solution)
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 90, in __init__
        self.update(other)
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/_vendor/boltons/setutils.py", line 304, in update
        for o in other:
      File "/mnt/data/home/psommer/miniconda/lib/python3.6/site-packages/conda/core/solve.py", line 407, in <genexpr>
        return IndexedSet(index[d] for d in solution)
    KeyError: Dist(channel='<unknown>', dist_name='dask-0.16.0-py36h73d177f_0', name='dask', version='0.16.0', build_string='py36h73d177f_0', build_number=0, base_url=None, platform=None)

`$ /mnt/data/home/psommer/miniconda/bin/conda install anaconda-client`

  environment variables:
                 CIO_TEST=<not set>
        CONDA_DEFAULT_ENV=root
        CONDA_PATH_BACKUP=/mnt/data/home/psommer/bin:/mnt/data/home/psommer/.local/bin:/usr/loca
                          l/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lo
                          cal/games:/snap/bin
             CONDA_PREFIX=/mnt/data/home/psommer/miniconda
         CONDA_PS1_BACKUP=
               CONDA_ROOT=/mnt/data/home/psommer/miniconda
                     PATH=/mnt/data/home/psommer/miniconda/bin:/mnt/data/home/psommer/bin:/mnt/d
                          ata/home/psommer/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/
                          usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
       REQUESTS_CA_BUNDLE=<not set>
            SSL_CERT_FILE=<not set>

     active environment : base
    active env location : /mnt/data/home/psommer/miniconda
       user config file : /mnt/data/home/psommer/.condarc
 populated config files : 
          conda version : 4.4.6
    conda-build version : not installed
         python version : 3.6.3.final.0
       base environment : /mnt/data/home/psommer/miniconda  (writable)
           channel URLs : 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
          package cache : /mnt/data/home/psommer/miniconda/pkgs
                          /mnt/data/home/psommer/.conda/pkgs
       envs directories : /mnt/data/home/psommer/miniconda/envs
                          /mnt/data/home/psommer/.conda/envs
               platform : linux-64
             user-agent : conda/4.4.6 requests/2.18.4 CPython/3.6.3 Linux/4.4.0-104-generic ubuntu/16.04 glibc/2.23
                UID:GID : 1042:1025
             netrc file : None
           offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
```

I also tried it with other packages independent of dask. Additionally it is unimportant which package I used for the last install command (here `conda install anaconda-client`). It always fails.


Discussion:
Thank you for the report! I didn't understand how #6621 was coming about.  The extra detail is exactly what I needed.  Very much appreciate it.
You're welcome! Thanks a lot for your work here!!

Resolving patch:
diff --git a/conda/models/dist.py b/conda/models/dist.py
--- a/conda/models/dist.py
+++ b/conda/models/dist.py
@@ -147,7 +147,7 @@ def from_string(cls, string, channel_override=NULL):
 
         if channel_override != NULL:
             channel = channel_override
-        elif channel is None:
+        if channel is None:
             channel = UNKNOWN_CHANNEL
 
         # enforce dist format


Test patch: