Repository: conda/conda-build

Issue:
3.0.5 indirect numpy dependency causes conflict
Minimal recipe to trigger the error:

```yaml
# Usage:
#   conda build -c defaults -c conda-forge .
package:
  name: checkthis

requirements:
  build:
    - arrow-cpp 0.5.*   # from conda-forge
```

This causes:

```
conda.exceptions.UnsatisfiableError: The following specifications were found to be in conflict:
  - numpy 1.11.*
  - numpy 1.13.1 py36_0
```

Numpy version must be specified (e.g. `--numpy=1.13`) for it to work. 

In conda-build 2.1.17, the recipe works with just `conda build -c defaults -c conda-forge .`







Discussion:
Thanks for reporting. This is the same issue that #2198 fixes. I'll tag a
release tomorrow morning first thing.

On Jul 13, 2017 7:10 PM, "Siu Kwan Lam" <notifications@github.com> wrote:

> Minimal recipe to trigger the error:
>
> # Usage:#   conda build -c defaults -c conda-forge .package:
>   name: checkthis
> requirements:
>   build:
>     - arrow-cpp 0.5.*   # from conda-forge
>
> This causes:
>
> conda.exceptions.UnsatisfiableError: The following specifications were found to be in conflict:
>   - numpy 1.11.*
>   - numpy 1.13.1 py36_0
>
> Numpy version must be specified (e.g. --numpy=1.13) for it to work.
>
> In conda-build 2.1.17, the recipe works with just conda build -c defaults
> -c conda-forge .
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/conda/conda-build/issues/2199>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AACV-SiRRZeyxu1kmJv4dBN4eqxWom8Oks5sNrH0gaJpZM4OXr3d>
> .
>

On second thought, this may be totally different. I'll add a test for this
and see how it shakes out. No matter what, thanks for reporting.

On Jul 13, 2017 22:12, "Michael Sarahan" <msarahan@continuum.io> wrote:

> Thanks for reporting. This is the same issue that #2198 fixes. I'll tag a
> release tomorrow morning first thing.
>
> On Jul 13, 2017 7:10 PM, "Siu Kwan Lam" <notifications@github.com> wrote:
>
>> Minimal recipe to trigger the error:
>>
>> # Usage:#   conda build -c defaults -c conda-forge .package:
>>   name: checkthis
>> requirements:
>>   build:
>>     - arrow-cpp 0.5.*   # from conda-forge
>>
>> This causes:
>>
>> conda.exceptions.UnsatisfiableError: The following specifications were found to be in conflict:
>>   - numpy 1.11.*
>>   - numpy 1.13.1 py36_0
>>
>> Numpy version must be specified (e.g. --numpy=1.13) for it to work.
>>
>> In conda-build 2.1.17, the recipe works with just conda build -c
>> defaults -c conda-forge .
>>
>> —
>> You are receiving this because you are subscribed to this thread.
>> Reply to this email directly, view it on GitHub
>> <https://github.com/conda/conda-build/issues/2199>, or mute the thread
>> <https://github.com/notifications/unsubscribe-auth/AACV-SiRRZeyxu1kmJv4dBN4eqxWom8Oks5sNrH0gaJpZM4OXr3d>
>> .
>>
>


Resolving patch:
diff --git a/conda_build/render.py b/conda_build/render.py
--- a/conda_build/render.py
+++ b/conda_build/render.py
@@ -85,8 +85,11 @@ def get_env_dependencies(m, env, variant, exclude_pattern=None,
                     is_subpackage = True
             if not is_subpackage:
                 dependencies.append(spec)
+            # fill in variant version iff no version at all is provided
             for key, value in variant.items():
-                if dash_or_under.sub("", key) == dash_or_under.sub("", spec_name):
+                # for sake of comparison, ignore dashes and underscores
+                if (dash_or_under.sub("", key) == dash_or_under.sub("", spec_name) and
+                        not re.search(r'%s\s+[0-9a-zA-Z\_\.]' % spec_name, spec)):
                     dependencies.append(" ".join((spec_name, value)))
         elif exclude_pattern.match(spec):
             pass_through_deps.append(spec)


Test patch:
diff --git a/tests/test_api_build.py b/tests/test_api_build.py
--- a/tests/test_api_build.py
+++ b/tests/test_api_build.py
@@ -1088,3 +1088,9 @@ def test_numpy_xx_host(testing_config):
 def test_python_xx(testing_config):
     recipe = os.path.join(metadata_dir, '_python_xx')
     api.build(recipe, config=testing_config, python='3.4')
+
+
+def test_indirect_numpy_dependency(testing_metadata):
+    testing_metadata.meta['requirements']['build'] = ['arrow-cpp 0.5.*']
+    testing_metadata.config.channel_urls = ['conda-forge']
+    api.build(testing_metadata, numpy=1.13)