Repository: conda/conda

Issue:
Conda Fails with create_default_packages
When using `create_default_packages`, `conda create...` fails. 
## Sample condarc:

```
channels:
  - defaults

create_default_packages:
  - python
  - pip
```
## Command

`conda create -n test_conda_update python=2 numpy`
## Error

```
    Traceback (most recent call last):
      File "/opt/a/b/c/muunitnoc/anaconda/lib/python2.7/site-packages/conda/exceptions.py", line 472, in conda_exception_handler
        return_value = func(*args, **kwargs)
      File "/opt/a/b/c/muunitnoc/anaconda/lib/python2.7/site-packages/conda/cli/main.py", line 144, in _main
        exit_code = args.func(args, p)
      File "/opt/a/b/c/muunitnoc/anaconda/lib/python2.7/site-packages/conda/cli/main_create.py", line 68, in execute
        install(args, parser, 'create')
      File "/opt/a/b/c/muunitnoc/anaconda/lib/python2.7/site-packages/conda/cli/install.py", line 171, in install
        default_packages.remove(default_pkg)
    AttributeError: 'tuple' object has no attribute 'remove'
```



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
@@ -63,7 +63,7 @@ def check_prefix(prefix, json=False):
     if name == ROOT_ENV_NAME:
         error = "'%s' is a reserved environment name" % name
     if exists(prefix):
-        if isdir(prefix) and not os.listdir(prefix):
+        if isdir(prefix) and 'conda-meta' not in os.listdir(prefix):
             return None
         error = "prefix already exists: %s" % prefix
 
@@ -164,7 +164,7 @@ def install(args, parser, command='install'):
                                            (name, prefix))
 
     if newenv and not args.no_default_packages:
-        default_packages = context.create_default_packages[:]
+        default_packages = list(context.create_default_packages)
         # Override defaults if they are specified at the command line
         for default_pkg in context.create_default_packages:
             if any(pkg.split('=')[0] == default_pkg for pkg in args.packages):


Test patch:
diff --git a/tests/test_create.py b/tests/test_create.py
--- a/tests/test_create.py
+++ b/tests/test_create.py
@@ -19,6 +19,7 @@
 from conda.cli.main_update import configure_parser as update_configure_parser
 from conda.common.io import captured, disable_logger, stderr_log_level
 from conda.common.url import path_to_url
+from conda.common.yaml import yaml_load
 from conda.compat import itervalues
 from conda.connection import LocalFSAdapter
 from conda.install import dist2dirname, linked as install_linked, linked_data, linked_data_, on_win
@@ -46,12 +47,15 @@ def escape_for_winpath(p):
     return p.replace('\\', '\\\\')
 
 
-def make_temp_prefix(name=None):
+def make_temp_prefix(name=None, create_directory=True):
     tempdir = gettempdir()
     dirname = str(uuid4())[:8] if name is None else name
     prefix = join(tempdir, dirname)
     os.makedirs(prefix)
-    assert isdir(prefix)
+    if create_directory:
+        assert isdir(prefix)
+    else:
+        os.removedirs(prefix)
     return prefix
 
 
@@ -591,3 +595,52 @@ def test_shortcut_absent_when_condarc_set(self):
             rmtree(prefix, ignore_errors=True)
             if isfile(shortcut_file):
                 os.remove(shortcut_file)
+
+    def test_create_default_packages(self):
+        # Regression test for #3453
+        try:
+            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 not package_is_installed(prefix, 'python-2')
+            assert not package_is_installed(prefix, 'numpy')
+            assert not package_is_installed(prefix, 'flask')
+
+            with make_temp_env("python=2", "numpy", prefix=prefix):
+                assert_package_is_installed(prefix, 'python-2')
+                assert_package_is_installed(prefix, 'numpy')
+                assert_package_is_installed(prefix, 'flask')
+
+        finally:
+            rmtree(prefix, ignore_errors=True)
+
+    def test_create_default_packages_no_default_packages(self):
+        try:
+            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 not package_is_installed(prefix, 'python-2')
+            assert not package_is_installed(prefix, 'numpy')
+            assert not package_is_installed(prefix, 'flask')
+
+            with make_temp_env("python=2", "numpy", "--no-default-packages", prefix=prefix):
+                assert_package_is_installed(prefix, 'python-2')
+                assert_package_is_installed(prefix, 'numpy')
+                assert not package_is_installed(prefix, 'flask')
+
+        finally:
+            rmtree(prefix, ignore_errors=True)