Repository: conda/conda-build

Issue:
AttributeError: 'dict' object has no attribute 'partition'
I'm trying to create a conda recipe for python-poppler-qt4 but they have a missing requirement which is sip so I can't do it using a skeleton, even though it's on pip. Having rolled my own meta file, I get the following stack trace:
<img width="602" alt="screen shot 2016-08-03 at 21 48 21" src="https://cloud.githubusercontent.com/assets/4128117/17381502/23cb4138-59c4-11e6-9af8-6343f474695e.png">

Here is the yaml file:

```
package:
    name: python-poppler-qt4
    version: 2.4.9

build:
    number: 0
    number: 2
    number: 3

requirements:
    build:
        - python
        - pip
        - pip:
            - sip
            - python-poppler-qt4


about:
    home: https://github.com/wbsoft/python-poppler-qt4
    license: LGPL
```

Here's the output of conda info:
<img width="602" alt="screen shot 2016-08-03 at 21 53 57" src="https://cloud.githubusercontent.com/assets/4128117/17381649/dd5b5304-59c4-11e6-8db6-8441b0b6cafe.png">

Any pointers?



Discussion:
You can't use the pip section in meta.yaml.  You need to restrict yourself
to what is available as conda packages.  If you have dependencies that are
not available on conda anywhere, you need to create recipes for them.

On Wed, Aug 3, 2016 at 3:50 PM Charlotte Godley notifications@github.com
wrote:

> I'm trying to create a conda recipe for python-poppler-qt4 but they have a
> missing requirement which is sip so I can't do it using a skeleton, even
> though it's on pip. Having rolled my own meta file, I get the following
> stack trace:
> [image: screen shot 2016-08-03 at 21 48 21]
> https://cloud.githubusercontent.com/assets/4128117/17381502/23cb4138-59c4-11e6-9af8-6343f474695e.png
> 
> Here is the yaml file:
> 
> package:
>     name: python-poppler-qt4
>     version: 2.4.9
> 
> build:
>     number: 0
>     number: 2
>     number: 3
> 
> requirements:
>     build:
>         - python
>         - pip
>         - pip:
>             - sip
>             - python-poppler-qt4
> 
> about:
>     home: https://github.com/wbsoft/python-poppler-qt4
>     license: LGPL
> 
> Any pointers?
> 
> —
> 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/1170, or mute the thread
> https://github.com/notifications/unsubscribe-auth/AACV-dA5zeGlqH-8r74o9dClbRS7YY9_ks5qcP8tgaJpZM4JcFQ-
> .

We have `sip` packages in the `defaults` channel:

```
conda search sip

sip                          4.15.5                   py26_0  defaults        
                             4.15.5                   py27_0  defaults        
                             4.15.5                   py33_0  defaults        
                             4.15.5                   py34_0  defaults        
                             4.16.5                   py26_0  defaults        
                             4.16.5                   py27_0  defaults        
                             4.16.5                   py33_0  defaults        
                             4.16.5                   py34_0  defaults        
                             4.16.5                   py35_0  defaults        
                             4.16.9                   py27_0  defaults        
                             4.16.9                   py34_0  defaults        
                          *  4.16.9                   py35_0  defaults        
                             4.18                     py27_0  defaults        
                             4.18                     py34_0  defaults        
                             4.18                     py35_0  defaults
```

.. and maybe some newer builds on https://anaconda.org/qttesting (where we are in the process of updating to Qt5)

Closing this issue as a misunderstanding of valid meta.yaml.  Please reopen or open a new issue if you have further questions.

Can we reopen this issue and add a check to see if someone was trying to do this in the meta.yaml so we can throw an informative stacktrace?

ha ha, I was just coming over here to suggest that. :-)

Sure, that's a good idea. 


Resolving patch:
diff --git a/conda_build/metadata.py b/conda_build/metadata.py
--- a/conda_build/metadata.py
+++ b/conda_build/metadata.py
@@ -556,6 +556,9 @@ def ms_depends(self, typ='run'):
                 ms = MatchSpec(spec)
             except AssertionError:
                 raise RuntimeError("Invalid package specification: %r" % spec)
+            except AttributeError:
+                raise RuntimeError("Received dictionary as spec.  Note that pip requirements are not "
+                                   "supported in conda-build meta.yaml.")
             if ms.name == self.name():
                 raise RuntimeError("%s cannot depend on itself" % self.name())
             for name, ver in name_ver_list:


Test patch:
diff --git a/tests/test-recipes/fail/pip_reqs_fail_informatively/meta.yaml b/tests/test-recipes/fail/pip_reqs_fail_informatively/meta.yaml
new file mode 100644
--- /dev/null
+++ b/tests/test-recipes/fail/pip_reqs_fail_informatively/meta.yaml
@@ -0,0 +1,9 @@
+package:
+  name: pip_reqs_fail_informatively
+  version: 1.0
+
+requirements:
+  build:
+    - python
+    - pip:
+      - setuptools
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
@@ -294,12 +294,17 @@ def test_symlink_fail(testing_workdir, test_config, capfd):
     assert error.count("Error") == 6, "did not find appropriate count of Error in: " + error
 
 
+def test_pip_in_meta_yaml_fail(testing_workdir, test_config):
+    with pytest.raises(RuntimeError) as exc:
+        api.build(os.path.join(fail_dir, "pip_reqs_fail_informatively"), config=test_config)
+        assert "Received dictionary as spec." in str(exc)
+
 @pytest.mark.skipif(sys.platform == "win32",
                     reason="Windows doesn't show this error")
 def test_broken_conda_meta(testing_workdir, test_config):
     with pytest.raises(SystemExit) as exc:
         api.build(os.path.join(fail_dir, "conda-meta"), config=test_config)
-        assert "Error: Untracked file(s) ('conda-meta/nope',)" in exc
+        assert "Error: Untracked file(s) ('conda-meta/nope',)" in str(exc)
 
 
 def test_recursive_fail(testing_workdir, test_config):