Repository: conda/conda-build

Issue:
conda install --yes flag ignored when --use-local set with conda-build 2.1.6
Trying to execute `conda install --yes --use-local {package}` from a package built with `conda-build` ignores the `--yes` flag and waits for user input. This [has](https://travis-ci.org/choderalab/openmmtools/jobs/209789665#L951) put a [halt](https://travis-ci.org/choderalab/pymbar/jobs/209453492#L646) to trying to do automatic builds as they time out, I am only using the 2 links as examples.

I can replicate the problem on my local machine and on downgrading to `conda-build` 2.1.5 the problem goes away, even without re-building the package. 


Discussion:
Sorry, but it looks like a coincidence that conda-build 2.1.5 works but 2.1.6 breaks.  Your build is succeeding (https://travis-ci.org/choderalab/openmmtools/jobs/209789665#L919), but it is only the conda step after that that is broken.  I'm going to move this issue to the conda issue tracker.

Also, this is concerning: https://travis-ci.org/choderalab/openmmtools/jobs/209789665#L925

you should probably add a pin to whichever jpeg you actually want, so that conda does not arbitrarily choose something you don't want.
Issue moved to [conda/conda #4848](https://github.com/conda/conda/issues/4848) via [**ZenHub**](https://www.zenhub.com/)

This seems to be a problem with `conda-index` which is a part of conda-build, so perhaps the issue belongs here after all.

This works as expected and a locally build package PKG is installed without any prompt:
```sh
conda update conda
conda install --no-deps conda-build=2.1.5
conda index /path/to/conda-bld/linux-64
conda install --yes --use-local PKG
```

After updating to conda-build 2.1.6 and reindexing local packages, the install command gives the `Proceed ([y]/n?)` prompt in spite of the `--yes` flag:

```sh
conda install --no-deps conda-build=2.1.6
conda index /path/to/conda-bld/linux-64
conda install --yes --use-local PKG
```
@pavoljuhas thanks for the reproduction instructions, that gives me much more to go on.  I have examined repodata.json and .index.json from both versions, and a diff shows absolutely no changes.  I therefore conclude that it is not a change in the index itself.  This is something more subtle, and I suspect the changes in https://github.com/conda/conda-build/pull/1791 - that's the primary source of changes related to conda in 2.1.6.  I'll keep digging at this.
I found a difference in the .q files in `pkgs/cache` after using conda-build 2.1.5 vs 2.1.6, however the .q files are not human-readable.

It seems that conda-install imports conda-build.   At a very least `conda install --use-local ...` crashes when conda-build is not installed.

> CondaRuntimeError: Runtime error: No module named conda_build.config: you need to have 'conda-build >= 1.7.1' installed to use the --use-local option.

I have found that it does not mater what version of `conda-build` was used to build the package, the only thing that maters is that it is `conda-build=2.1.6` that is installed at the time you try to instal the package.

i.e.:
```
conda install conda-build=2.1.6
conda build PKG-META-DIR
conda install --yes --use-local PKG
```
and
```
conda install conda-build=2.1.5
conda build PKG-META-DIR
conda install conda-build=2.1.6
conda install --yes --use-local PKG
```
both yield the same problem of prompting the `Proceed ([y]/n?)` message whereas
```
conda install conda-build=2.1.5
conda build PKG-META-DIR
conda install --yes --use-local PKG
```
and
```
conda install conda-build=2.1.6
conda build PKG-META-DIR
conda install conda-build=2.1.5
conda install --yes --use-local PKG
```
both correctly install the package without the prompt.
The problem is here: https://github.com/conda/conda-build/blob/2.1.x/conda_build/conda_interface.py#L158

That ``reset_context()`` call reloads configuration from files, but loses the CLI arguments.

In the past, conda-build's configuration of conda did not affect conda itself outside of conda-build runs.  I need to talk with @kalefranz about why this behavior is new, and how to avoid it.  Conda-build should be able to have conda settings that only affect conda behavior within conda-build.

Resolving patch:
diff --git a/conda_build/conda_interface.py b/conda_build/conda_interface.py
--- a/conda_build/conda_interface.py
+++ b/conda_build/conda_interface.py
@@ -9,6 +9,17 @@
 
 from conda import __version__ as CONDA_VERSION
 
+
+try:
+    # This monkey patch is addressed at #1825. The ensure_use_local is an outdated vestige
+    #   and no longer has any relevant effect.
+    import conda.cli.common
+    conda.cli.common.ensure_use_local = lambda x: None
+except ImportError:
+    # no need to patch if it doesn't exist
+    pass
+
+
 from conda.plan import display_actions, execute_actions, execute_plan, install_actions
 display_actions, execute_actions, execute_plan = display_actions, execute_actions, execute_plan
 install_actions = install_actions


Test patch: