Repository: conda/conda

Issue:
conda env export failure
Under conda 4.3.1, `conda env export` returns the backtrace:

```Python
    Traceback (most recent call last):
      File "/home/alan/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 515, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/home/alan/anaconda/lib/python3.5/site-packages/conda_env/cli/main_export.py", line 94, in execute
        ignore_channels=args.ignore_channels)
      File "/home/alan/anaconda/lib/python3.5/site-packages/conda_env/env.py", line 62, in from_environment
        for dist in installed:
    AttributeError: 'str' object has no attribute 'channel'
```

My current conda information:
```
Current conda install:

               platform : linux-64
          conda version : 4.3.1
       conda is private : False
      conda-env version : 4.3.1
    conda-build version : 2.0.12
         python version : 3.5.2.final.0
       requests version : 2.12.4
       root environment : /home/alan/anaconda  (writable)
    default environment : /home/alan/anaconda/envs/labs
       envs directories : /home/alan/anaconda/envs
          package cache : /home/alan/anaconda/pkgs
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/conda-canary/linux-64
                          https://conda.anaconda.org/conda-canary/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
            config file : /home/alan/.condarc
           offline mode : False
             user-agent : conda/4.3.1 requests/2.12.4 CPython/3.5.2 Linux/4.4.0-57-generic debian/stretch/sid glibc/2.23
                UID:GID : 1000:1000
```
conda env export failure
Under conda 4.3.1, `conda env export` returns the backtrace:

```Python
    Traceback (most recent call last):
      File "/home/alan/anaconda/lib/python3.5/site-packages/conda/exceptions.py", line 515, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/home/alan/anaconda/lib/python3.5/site-packages/conda_env/cli/main_export.py", line 94, in execute
        ignore_channels=args.ignore_channels)
      File "/home/alan/anaconda/lib/python3.5/site-packages/conda_env/env.py", line 62, in from_environment
        for dist in installed:
    AttributeError: 'str' object has no attribute 'channel'
```

My current conda information:
```
Current conda install:

               platform : linux-64
          conda version : 4.3.1
       conda is private : False
      conda-env version : 4.3.1
    conda-build version : 2.0.12
         python version : 3.5.2.final.0
       requests version : 2.12.4
       root environment : /home/alan/anaconda  (writable)
    default environment : /home/alan/anaconda/envs/labs
       envs directories : /home/alan/anaconda/envs
          package cache : /home/alan/anaconda/pkgs
           channel URLs : https://conda.anaconda.org/conda-forge/linux-64
                          https://conda.anaconda.org/conda-forge/noarch
                          https://conda.anaconda.org/conda-canary/linux-64
                          https://conda.anaconda.org/conda-canary/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
            config file : /home/alan/.condarc
           offline mode : False
             user-agent : conda/4.3.1 requests/2.12.4 CPython/3.5.2 Linux/4.4.0-57-generic debian/stretch/sid glibc/2.23
                UID:GID : 1000:1000
```


Discussion:

Resolving patch:
diff --git a/conda_env/env.py b/conda_env/env.py
--- a/conda_env/env.py
+++ b/conda_env/env.py
@@ -36,10 +36,9 @@ def from_environment(name, prefix, no_builds=False, ignore_channels=False):
         name: The name of environment
         prefix: The path of prefix
         no_builds: Whether has build requirement
-        ignore_channels: whether ingore_channels
-
-    Returns:     Environment obejct
+        ignore_channels: whether ignore_channels
 
+    Returns:     Environment object
     """
     installed = linked(prefix, ignore_channels=ignore_channels)
     conda_pkgs = copy(installed)
@@ -58,7 +57,7 @@ def from_environment(name, prefix, no_builds=False, ignore_channels=False):
     # this doesn't dump correctly using pyyaml
     channels = list(context.channels)
     if not ignore_channels:
-        for dist in installed:
+        for dist in conda_pkgs:
             if dist.channel not in channels:
                 channels.insert(0, dist.channel)
     return Environment(name=name, dependencies=dependencies, channels=channels, prefix=prefix)


Test patch: