Repository: conda/conda

Issue:
create_default_packages rules out --clone
Hi all,

In case of the .condarc file defining the 'create_default_packages' options, the conda --clone command gives a confusing error messages:
alain@alain-K53E:~$ conda create --name flowersqq --clone snowflakes
Fetching package metadata: ....
Error: did not expect any arguments for --clone
alain@alain-K53E:~$ 

Here my settings:
lain@alain-K53E:~$ conda info
    Current conda install:

```
         platform : linux-32
    conda version : 3.16.0
  conda-build version : 1.16.0
   python version : 2.7.10.final.0
 requests version : 2.7.0
 root environment : /home/alain/miniconda  (writable)
  default environment : /home/alain/miniconda
 envs directories : /home/alain/test/conda-envs
    package cache : /home/alain/test/conda-envs/.pkgs
     channel URLs : https://repo.continuum.io/pkgs/free/linux-32/
                    https://repo.continuum.io/pkgs/free/noarch/
                    https://repo.continuum.io/pkgs/pro/linux-32/
                    https://repo.continuum.io/pkgs/pro/noarch/
      config file : /home/alain/.condarc_env
is foreign system : False
```

alain@alain-K53E:~$ 
alain@alain-K53E:~$ cat /home/alain/.condarc_env
    channels:
    - defaults
    # Directories in which environments are located.
    envs_dirs:
     - ~/test/conda-envs
    create_default_packages:
      - python
      - pip
    binstar_upload: False
    binstar_personal: True
alain@alain-K53E:~$

And here the workaround for me (luckily i was able to browse the source code: https://github.com/algorete/apkg/blob/master/conda/cli/install.py, this gave me a hint, but i do not really understand..)

alain@alain-K53E:~$ conda create --name flowersqq --clone snowflakes --no-default-packages
Fetching package metadata: ....
src_prefix: '/home/alain/test/conda-envs/snowflakes'
dst_prefix: '/home/alain/test/conda-envs/flowersqq'
Packages: 14
Files: 0
Linking packages ...
[      COMPLETE      ]|#################################################################################################| 100%

alain@alain-K53E:~$ 

Kind Regards
Alain

P.S: I could understand that changing the .condrc file to include default packages _after_ having created an env which did not define the create_default_packages could confuse the '--clone', but the problem seems always present.



Discussion:

Resolving patch:
diff --git a/conda/cli/install.py b/conda/cli/install.py
--- a/conda/cli/install.py
+++ b/conda/cli/install.py
@@ -169,6 +169,8 @@ def install(args, parser, command='install'):
             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 = []
 
     common.ensure_override_channels_requires_channel(args)
     channel_urls = args.channel or ()
@@ -244,7 +246,7 @@ def install(args, parser, command='install'):
                                   offline=args.offline)
 
     if newenv and args.clone:
-        if args.packages:
+        if set(args.packages) - set(default_packages):
             common.error_and_exit('did not expect any arguments for --clone',
                                   json=args.json,
                                   error_type="ValueError")


Test patch: