Repository: conda/conda

Issue:
Conda 4.3 not installing default packages
I have the following `.condarc`:

```
channels:
  - conda-forge
  - defaults

create_default_packages:
  - ipython
```

When creating a new environment with `conda 4.3.22`  the `ipython` package is not included:

```
$ conda create -n testenv python=3
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment /home/ubuntu/miniconda/envs/OCemptor5:

The following NEW packages will be INSTALLED:

    ca-certificates: 2017.4.17-0      conda-forge
    certifi:         2017.4.17-py36_0 conda-forge
    ncurses:         5.9-10           conda-forge
    openssl:         1.0.2k-0         conda-forge
    pip:             9.0.1-py36_0     conda-forge
    python:          3.6.1-3          conda-forge
    readline:        6.2-0            conda-forge
    setuptools:      33.1.1-py36_0    conda-forge
    sqlite:          3.13.0-1         conda-forge
    tk:              8.5.19-1         conda-forge
    wheel:           0.29.0-py36_0    conda-forge
    xz:              5.2.2-0          conda-forge
    zlib:            1.2.11-0         conda-forge

Proceed ([y]/n)?
```

And when using latest 4.2.13 version the default packages are included:

```
$ conda create -n testenv python=3
Fetching package metadata ...........
Solving package specifications: ..........

Package plan for installation in environment /home/ubuntu/miniconda/envs/OCemptor5:

The following NEW packages will be INSTALLED:

    ca-certificates:  2017.4.17-0      conda-forge
    certifi:          2017.4.17-py36_0 conda-forge
    decorator:        4.0.11-py36_0    conda-forge
    ipython:          6.1.0-py36_0     conda-forge
    ipython_genutils: 0.2.0-py36_0     conda-forge
    jedi:             0.10.0-py36_0    conda-forge
    ncurses:          5.9-10           conda-forge
    openssl:          1.0.2k-0         conda-forge
    pexpect:          4.2.1-py36_0     conda-forge
    pickleshare:      0.7.3-py36_0     conda-forge
    pip:              9.0.1-py36_0     conda-forge
    prompt_toolkit:   1.0.14-py36_0    conda-forge
    ptyprocess:       0.5.2-py36_0     conda-forge
    pygments:         2.2.0-py36_0     conda-forge
    python:           3.6.1-3          conda-forge
    readline:         6.2-0            conda-forge
    setuptools:       33.1.1-py36_0    conda-forge
    simplegeneric:    0.8.1-py36_0     conda-forge
    six:              1.10.0-py36_1    conda-forge
    sqlite:           3.13.0-1         conda-forge
    tk:               8.5.19-1         conda-forge
    traitlets:        4.3.2-py36_0     conda-forge
    wcwidth:          0.1.7-py36_0     conda-forge
    wheel:            0.29.0-py36_0    conda-forge
    xz:               5.2.2-0          conda-forge
    zlib:             1.2.11-0         conda-forge

Proceed ([y]/n)?
```
Conda 4.3 not installing default packages
I have the following `.condarc`:

```
channels:
  - conda-forge
  - defaults

create_default_packages:
  - ipython
```

When creating a new environment with `conda 4.3.22`  the `ipython` package is not included:

```
$ conda create -n testenv python=3
Fetching package metadata .............
Solving package specifications: .

Package plan for installation in environment /home/ubuntu/miniconda/envs/OCemptor5:

The following NEW packages will be INSTALLED:

    ca-certificates: 2017.4.17-0      conda-forge
    certifi:         2017.4.17-py36_0 conda-forge
    ncurses:         5.9-10           conda-forge
    openssl:         1.0.2k-0         conda-forge
    pip:             9.0.1-py36_0     conda-forge
    python:          3.6.1-3          conda-forge
    readline:        6.2-0            conda-forge
    setuptools:      33.1.1-py36_0    conda-forge
    sqlite:          3.13.0-1         conda-forge
    tk:              8.5.19-1         conda-forge
    wheel:           0.29.0-py36_0    conda-forge
    xz:              5.2.2-0          conda-forge
    zlib:            1.2.11-0         conda-forge

Proceed ([y]/n)?
```

And when using latest 4.2.13 version the default packages are included:

```
$ conda create -n testenv python=3
Fetching package metadata ...........
Solving package specifications: ..........

Package plan for installation in environment /home/ubuntu/miniconda/envs/OCemptor5:

The following NEW packages will be INSTALLED:

    ca-certificates:  2017.4.17-0      conda-forge
    certifi:          2017.4.17-py36_0 conda-forge
    decorator:        4.0.11-py36_0    conda-forge
    ipython:          6.1.0-py36_0     conda-forge
    ipython_genutils: 0.2.0-py36_0     conda-forge
    jedi:             0.10.0-py36_0    conda-forge
    ncurses:          5.9-10           conda-forge
    openssl:          1.0.2k-0         conda-forge
    pexpect:          4.2.1-py36_0     conda-forge
    pickleshare:      0.7.3-py36_0     conda-forge
    pip:              9.0.1-py36_0     conda-forge
    prompt_toolkit:   1.0.14-py36_0    conda-forge
    ptyprocess:       0.5.2-py36_0     conda-forge
    pygments:         2.2.0-py36_0     conda-forge
    python:           3.6.1-3          conda-forge
    readline:         6.2-0            conda-forge
    setuptools:       33.1.1-py36_0    conda-forge
    simplegeneric:    0.8.1-py36_0     conda-forge
    six:              1.10.0-py36_1    conda-forge
    sqlite:           3.13.0-1         conda-forge
    tk:               8.5.19-1         conda-forge
    traitlets:        4.3.2-py36_0     conda-forge
    wcwidth:          0.1.7-py36_0     conda-forge
    wheel:            0.29.0-py36_0    conda-forge
    xz:               5.2.2-0          conda-forge
    zlib:             1.2.11-0         conda-forge

Proceed ([y]/n)?
```


Discussion:
Conda always prioritizes conda-forge over the default channel by design. 
You can either temporarily remove conda-forge from your .condarc or add `-c defaults` in your command. 
@tyler-thetyrant By default packages I mean the ones specified in the config `create_default_packages`.

When using conda 4.3 it doesn't honor the `create_default_packages` config.
@kalefranz I see this one too in the testing installer for the next AEN version. Can you take a look on this?

conda_info

```
(/projects/testuser11/test_public/envs/default) conda info                                                                                                                 
Current conda install:                                                                                                                                                     
                                                                                                                                                                           
               platform : linux-64                                                                                                                                         
          conda version : 4.3.22                                                                                                                                           
       conda is private : False                                                                                                                                            
      conda-env version : 4.3.22                                                                                                                                           
    conda-build version : 3.0.6                                                                                                                                            
         python version : 2.7.13.final.0                                                                                                                                   
       requests version : 2.14.2                                                                                                                                           
       root environment : /opt/wakari/anaconda  (read only)                                                                                                                
    default environment : /projects/testuser11/test_public/envs/default                                                                                                    
       envs directories : /projects/testuser11/test_public/envs                                                                                                            
                          /projects/testuser11/test_public/DEFAULTS                                                                                                        
                          /home/testuser11/.conda/envs                                                                                                                     
                          /opt/wakari/anaconda/envs                                                                                                                        
          package cache : /opt/wakari/anaconda/pkgs                                                                                                                        
                          /home/testuser11/.conda/pkgs                                                                                                                     
           channel URLs : https://conda.anaconda.org/r/linux-64                                                                                                            
                          https://conda.anaconda.org/r/noarch                                                                                                              
                          https://conda.anaconda.org/wakari/linux-64                                                                                                       
                          https://conda.anaconda.org/wakari/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 : /opt/wakari/anaconda/.condarc                                                                                                                    
             netrc file : None                                                                                                                                             
           offline mode : False                                                                                                                                            
             user-agent : conda/4.3.22 requests/2.14.2 CPython/2.7.13 Linux/2.6.32-696.3.1.el6.x86_64 CentOS/6.9 glibc/2.12                                                
                UID:GID : 500:500  
```

and `.condarc`

```
(projects/testuser11/test_public/envs/default) cat /opt/wakari/anaconda/.condarc                                                                                          
channels:                                                                                                                                                                  
  - r                                                                                                                                                                      
  - https://conda.anaconda.org/wakari                                                                                                                                      
  - defaults                                                                                                                                                               
create_default_packages:                                                                                                                                                   
  - anaconda-client                                                                                                                                                        
  - ipykernel                                                                                                                                                              
auto_update_conda: false
```

And when I try to create a env, it does not contain the default_packages as expected

```
(/projects/testuser11/test_public/envs/default) conda create -n bar                                                                                                        
Fetching package metadata .............                                                                                                                                    
Solving package specifications:                                                                                                                                            
Package plan for installation in environment /projects/testuser11/test_public/envs/bar:                                                                                    
                                                                                                                                                                           
Proceed ([y]/n)? y                                                                                                                                                         
                                                                                                                                                                           
#                                                                                                                                                                          
# To activate this environment, use:                                                                                                                                       
# > source activate bar                                                                                                                                                    
#                                                                                                                                                                          
# To deactivate an active environment, use:                                                                                                                                
# > source deactivate                                                                                                                                                      
#                                                                                                                                                                          
                                                                                                                                                                           
(/projects/testuser11/test_public/envs/default) conda list -n bar                                                                                                          
# packages in environment at /projects/testuser11/test_public/envs/bar:                                                                                                    
#                                                                                                                                                                          
                                                                                                                                                                           
(/projects/testuser11/test_public/envs/default) ^C   
```

cc @csoja 
Conda always prioritizes conda-forge over the default channel by design. 
You can either temporarily remove conda-forge from your .condarc or add `-c defaults` in your command. 
@tyler-thetyrant By default packages I mean the ones specified in the config `create_default_packages`.

When using conda 4.3 it doesn't honor the `create_default_packages` config.
@kalefranz I see this one too in the testing installer for the next AEN version. Can you take a look on this?

conda_info

```
(/projects/testuser11/test_public/envs/default) conda info                                                                                                                 
Current conda install:                                                                                                                                                     
                                                                                                                                                                           
               platform : linux-64                                                                                                                                         
          conda version : 4.3.22                                                                                                                                           
       conda is private : False                                                                                                                                            
      conda-env version : 4.3.22                                                                                                                                           
    conda-build version : 3.0.6                                                                                                                                            
         python version : 2.7.13.final.0                                                                                                                                   
       requests version : 2.14.2                                                                                                                                           
       root environment : /opt/wakari/anaconda  (read only)                                                                                                                
    default environment : /projects/testuser11/test_public/envs/default                                                                                                    
       envs directories : /projects/testuser11/test_public/envs                                                                                                            
                          /projects/testuser11/test_public/DEFAULTS                                                                                                        
                          /home/testuser11/.conda/envs                                                                                                                     
                          /opt/wakari/anaconda/envs                                                                                                                        
          package cache : /opt/wakari/anaconda/pkgs                                                                                                                        
                          /home/testuser11/.conda/pkgs                                                                                                                     
           channel URLs : https://conda.anaconda.org/r/linux-64                                                                                                            
                          https://conda.anaconda.org/r/noarch                                                                                                              
                          https://conda.anaconda.org/wakari/linux-64                                                                                                       
                          https://conda.anaconda.org/wakari/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 : /opt/wakari/anaconda/.condarc                                                                                                                    
             netrc file : None                                                                                                                                             
           offline mode : False                                                                                                                                            
             user-agent : conda/4.3.22 requests/2.14.2 CPython/2.7.13 Linux/2.6.32-696.3.1.el6.x86_64 CentOS/6.9 glibc/2.12                                                
                UID:GID : 500:500  
```

and `.condarc`

```
(projects/testuser11/test_public/envs/default) cat /opt/wakari/anaconda/.condarc                                                                                          
channels:                                                                                                                                                                  
  - r                                                                                                                                                                      
  - https://conda.anaconda.org/wakari                                                                                                                                      
  - defaults                                                                                                                                                               
create_default_packages:                                                                                                                                                   
  - anaconda-client                                                                                                                                                        
  - ipykernel                                                                                                                                                              
auto_update_conda: false
```

And when I try to create a env, it does not contain the default_packages as expected

```
(/projects/testuser11/test_public/envs/default) conda create -n bar                                                                                                        
Fetching package metadata .............                                                                                                                                    
Solving package specifications:                                                                                                                                            
Package plan for installation in environment /projects/testuser11/test_public/envs/bar:                                                                                    
                                                                                                                                                                           
Proceed ([y]/n)? y                                                                                                                                                         
                                                                                                                                                                           
#                                                                                                                                                                          
# To activate this environment, use:                                                                                                                                       
# > source activate bar                                                                                                                                                    
#                                                                                                                                                                          
# To deactivate an active environment, use:                                                                                                                                
# > source deactivate                                                                                                                                                      
#                                                                                                                                                                          
                                                                                                                                                                           
(/projects/testuser11/test_public/envs/default) conda list -n bar                                                                                                          
# packages in environment at /projects/testuser11/test_public/envs/bar:                                                                                                    
#                                                                                                                                                                          
                                                                                                                                                                           
(/projects/testuser11/test_public/envs/default) ^C   
```

cc @csoja 

Resolving patch:
diff --git a/conda/cli/install.py b/conda/cli/install.py
--- a/conda/cli/install.py
+++ b/conda/cli/install.py
@@ -163,14 +163,13 @@ def install(args, parser, command='install'):
                 raise PackageNotInstalledError(prefix, name)
 
     if newenv and not args.no_default_packages:
-        default_packages = list(context.create_default_packages)
         # Override defaults if they are specified at the command line
+        # TODO: rework in 4.4 branch using MatchSpec
+        args_packages_names = [pkg.replace(' ', '=').split('=', 1)[0] for pkg in args_packages]
         for default_pkg in context.create_default_packages:
-            if any(pkg.split('=')[0] == default_pkg for pkg in args_packages):
-                default_packages.remove(default_pkg)
-                args_packages.extend(default_packages)
-    else:
-        default_packages = []
+            default_pkg_name = default_pkg.replace(' ', '=').split('=', 1)[0]
+            if default_pkg_name not in args_packages_names:
+                args_packages.append(default_pkg)
 
     common.ensure_use_local(args)
     common.ensure_override_channels_requires_channel(args)
@@ -212,9 +211,8 @@ def install(args, parser, command='install'):
                                   " filenames")
 
     if newenv and args.clone:
-        package_diff = set(args_packages) - set(default_packages)
-        if package_diff:
-            raise TooManyArgumentsError(0, len(package_diff), list(package_diff),
+        if args.packages:
+            raise TooManyArgumentsError(0, len(args.packages), list(args.packages),
                                         'did not expect any arguments for --clone')
 
         clone(args.clone, prefix, json=context.json, quiet=context.quiet, index_args=index_args)


Test patch:
diff --git a/tests/test_activate.py b/tests/test_activate.py
--- a/tests/test_activate.py
+++ b/tests/test_activate.py
@@ -191,7 +191,7 @@ def test_activate_bad_env_keeps_existing_good_env(shell):
 
 @pytest.mark.installed
 def test_activate_deactivate(shell):
-    if shell == "bash.exe" and datetime.now() < datetime(2017, 7, 1):
+    if shell == "bash.exe" and datetime.now() < datetime(2017, 8, 1):
         pytest.xfail("fix this soon")
     shell_vars = _format_vars(shell)
     with TemporaryDirectory(prefix=ENVS_PREFIX, dir=dirname(__file__)) as envs:
@@ -208,7 +208,7 @@ def test_activate_deactivate(shell):
 
 @pytest.mark.installed
 def test_activate_root_simple(shell):
-    if shell == "bash.exe" and datetime.now() < datetime(2017, 7, 1):
+    if shell == "bash.exe" and datetime.now() < datetime(2017, 8, 1):
         pytest.xfail("fix this soon")
     shell_vars = _format_vars(shell)
     with TemporaryDirectory(prefix=ENVS_PREFIX, dir=dirname(__file__)) as envs:
diff --git a/tests/test_create.py b/tests/test_create.py
--- a/tests/test_create.py
+++ b/tests/test_create.py
@@ -674,7 +674,7 @@ def test_update_deps_flag_absent(self):
             assert package_is_installed(prefix, 'itsdangerous-0.23')
             assert package_is_installed(prefix, 'flask')
 
-    @pytest.mark.xfail(datetime.now() < datetime(2017, 7, 1), reason="#5263", strict=True)
+    @pytest.mark.xfail(datetime.now() < datetime(2017, 8, 1), reason="#5263", strict=True)
     def test_update_deps_flag_present(self):
         with make_temp_env("python=2 itsdangerous=0.23") as prefix:
             assert package_is_installed(prefix, 'python-2')
@@ -794,12 +794,11 @@ def test_create_default_packages(self):
             prefix = make_temp_prefix(str(uuid4())[:7])
 
             # set packages
-            run_command(Commands.CONFIG, prefix, "--add create_default_packages python")
             run_command(Commands.CONFIG, prefix, "--add create_default_packages pip")
             run_command(Commands.CONFIG, prefix, "--add create_default_packages flask")
             stdout, stderr = run_command(Commands.CONFIG, prefix, "--show")
             yml_obj = yaml_load(stdout)
-            assert yml_obj['create_default_packages'] == ['flask', 'pip', 'python']
+            assert yml_obj['create_default_packages'] == ['flask', 'pip']
 
             assert not package_is_installed(prefix, 'python-2')
             assert not package_is_installed(prefix, 'pytz')
@@ -818,12 +817,11 @@ def test_create_default_packages_no_default_packages(self):
             prefix = make_temp_prefix(str(uuid4())[:7])
 
             # set packages
-            run_command(Commands.CONFIG, prefix, "--add create_default_packages python")
             run_command(Commands.CONFIG, prefix, "--add create_default_packages pip")
             run_command(Commands.CONFIG, prefix, "--add create_default_packages flask")
             stdout, stderr = run_command(Commands.CONFIG, prefix, "--show")
             yml_obj = yaml_load(stdout)
-            assert yml_obj['create_default_packages'] == ['flask', 'pip', 'python']
+            assert yml_obj['create_default_packages'] == ['flask', 'pip']
 
             assert not package_is_installed(prefix, 'python-2')
             assert not package_is_installed(prefix, 'pytz')
diff --git a/tests/test_export.py b/tests/test_export.py
--- a/tests/test_export.py
+++ b/tests/test_export.py
@@ -31,7 +31,7 @@ def test_basic(self):
             output2, error= run_command(Commands.LIST, prefix2, "-e")
             self.assertEqual(output, output2)
 
-    @pytest.mark.xfail(datetime.now() < datetime(2017, 7, 1), reason="Bring back `conda list --export` #3445", strict=True)
+    @pytest.mark.xfail(datetime.now() < datetime(2017, 8, 1), reason="Bring back `conda list --export` #3445", strict=True)
     def test_multi_channel_export(self):
         """
             When try to import from txt