{"action":"created","issue":{"url":"https://api.github.com/repos/numba/numba/issues/3068","repository_url":"https://api.github.com/repos/numba/numba","labels_url":"https://api.github.com/repos/numba/numba/issues/3068/labels{/name}","comments_url":"https://api.github.com/repos/numba/numba/issues/3068/comments","events_url":"https://api.github.com/repos/numba/numba/issues/3068/events","html_url":"https://github.com/numba/numba/issues/3068","id":337076013,"node_id":"MDU6SXNzdWUzMzcwNzYwMTM=","number":3068,"title":"Trying to initialize np.empty gives \"All templates rejected\" error","user":{"login":"frstyang","id":10657698,"node_id":"MDQ6VXNlcjEwNjU3Njk4","avatar_url":"https://avatars1.githubusercontent.com/u/10657698?v=4","gravatar_id":"","url":"https://api.github.com/users/frstyang","html_url":"https://github.com/frstyang","followers_url":"https://api.github.com/users/frstyang/followers","following_url":"https://api.github.com/users/frstyang/following{/other_user}","gists_url":"https://api.github.com/users/frstyang/gists{/gist_id}","starred_url":"https://api.github.com/users/frstyang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frstyang/subscriptions","organizations_url":"https://api.github.com/users/frstyang/orgs","repos_url":"https://api.github.com/users/frstyang/repos","events_url":"https://api.github.com/users/frstyang/events{/privacy}","received_events_url":"https://api.github.com/users/frstyang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-29T17:21:20Z","updated_at":"2018-06-29T17:29:52Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n\r\nThanks for opening an issue! To help the Numba team handle your information\r\nefficiently, please first ensure that there is no other issue present that\r\nalready describes the issue you have\r\n(search at https://github.com/numba/numba/issues?&q=is%3Aissue).\r\n\r\nIf there is no issue present please jump to a section below and delete the\r\nirrelevant one depending on whether you are:\r\n\r\n * Making a feature request.\r\n * Reporting a bug.\r\n\r\nFor more general \"how do I do X?\" type questions, please speak to us in real\r\ntime on https://gitter.im/numba/numba or post to the Numba mailing list\r\nhttps://groups.google.com/a/continuum.io/forum/#!forum/numba-users.\r\n\r\n-->\r\n\r\n## Feature request\r\n\r\n<!--\r\n\r\nPlease include details of the feature you would like to see, why you would\r\nlike to see it/the use case\r\n\r\n-->\r\n\r\n## Reporting a bug\r\n\r\n<!--\r\n\r\nBefore submitting a bug report please ensure that you can check off these boxes:\r\n\r\n-->\r\n\r\n- [ ] I am using the latest released version of Numba (most recent is visible in\r\n the change log (https://github.com/numba/numba/blob/master/CHANGE_LOG).\r\n- [ ] I have included below a minimal working reproducer (if you are unsure how\r\n to write one see http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports).\r\n\r\n<!--\r\n\r\nPlease include details of the bug here, including, if applicable, what you\r\nexpected to happen!\r\n\r\n\r\n\r\n-->\r\nI ran into this weird error when trying to use np.empty in a function definition compiled with numba, and turning on nopython=True to make sure optimized typing is in effect. It's weird because numba claims to support np.empty with the first two arguments, and I am only using the first two arguments (correctly I think?), so I don't know why it's not typing correctly.\r\n\r\n    @jit(nopython=True)\r\n    def empty():\r\n        return np.empty(5, np.float)\r\n\r\nAfter defining the above function in an ipython notebook,\r\n\r\n    empty()\r\n\r\nGives the following error message:\r\n\r\n    ---------------------------------------------------------------------------\r\n    TypingError                               Traceback (most recent call last)\r\n    <ipython-input-88-927345c8757f> in <module>()\r\n    ----> 1 empty()\r\n    \r\n    ~/.../lib/python3.5/site-packages/numba/dispatcher.py in _compile_for_args(self, *args, **kws)\r\n        342                 raise e\r\n        343             else:\r\n    --> 344                 reraise(type(e), e, None)\r\n        345         except errors.UnsupportedError as e:\r\n        346             # Something unsupported is present in the user code, add help info\r\n    \r\n    ~/.../lib/python3.5/site-packages/numba/six.py in reraise(tp, value, tb)\r\n        656             value = tp()\r\n        657         if value.__traceback__ is not tb:\r\n    --> 658             raise value.with_traceback(tb)\r\n        659         raise value\r\n        660 \r\n    TypingError: Failed at nopython (nopython frontend)\r\n    Invalid usage of Function(<built-in function empty>) with parameters (int64, Function(<class 'float'>))\r\n     * parameterized\r\n    In definition 0:\r\n        All templates rejected\r\n    [1] During: resolving callee type: Function(<built-in function empty>)\r\n    [2] During: typing of call at <ipython-input-87-8c7e8fa4c6eb> (3)\r\n    \r\n    \r\n    File \"<ipython-input-87-8c7e8fa4c6eb>\", line 3:\r\n    def empty():\r\n        return np.empty(5, np.float)\r\n        ^\r\n    \r\n    This is not usually a problem with Numba itself but instead often caused by\r\n    the use of unsupported features or an issue in resolving types.\r\n    \r\n    To see Python/NumPy features supported by the latest release of Numba visit:\r\n    http://numba.pydata.org/numba-doc/dev/reference/pysupported.html\r\n    and\r\n    http://numba.pydata.org/numba-doc/dev/reference/numpysupported.html\r\n    \r\n    For more information about typing errors and how to debug them visit:\r\n    http://numba.pydata.org/numba-doc/latest/user/troubleshoot.html#my-code-doesn-t-compile\r\n    \r\n    If you think your code should work with Numba, please report the error message\r\n    and traceback, along with a minimal reproducer at:\r\n    https://github.com/numba/numba/issues/new\r\n"},"comment":{"url":"https://api.github.com/repos/numba/numba/issues/comments/401421637","html_url":"https://github.com/numba/numba/issues/3068#issuecomment-401421637","issue_url":"https://api.github.com/repos/numba/numba/issues/3068","id":401421637,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTQyMTYzNw==","user":{"login":"seibert","id":425352,"node_id":"MDQ6VXNlcjQyNTM1Mg==","avatar_url":"https://avatars1.githubusercontent.com/u/425352?v=4","gravatar_id":"","url":"https://api.github.com/users/seibert","html_url":"https://github.com/seibert","followers_url":"https://api.github.com/users/seibert/followers","following_url":"https://api.github.com/users/seibert/following{/other_user}","gists_url":"https://api.github.com/users/seibert/gists{/gist_id}","starred_url":"https://api.github.com/users/seibert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seibert/subscriptions","organizations_url":"https://api.github.com/users/seibert/orgs","repos_url":"https://api.github.com/users/seibert/repos","events_url":"https://api.github.com/users/seibert/events{/privacy}","received_events_url":"https://api.github.com/users/seibert/received_events","type":"User","site_admin":false},"created_at":"2018-06-29T17:29:52Z","updated_at":"2018-06-29T17:29:52Z","author_association":"CONTRIBUTOR","body":"This is a problem because Numba doesn't recognize `np.float` (which is not a NumPy type object, but rather the global Python `float` type) as a valid dtype.  If you switch `float` for `float64`, this example works.\r\n\r\nI think this is an easy fix to make sure we handle the expected aliasing of `float` = `float64` and `int` => `int64`."}}
{"actor":{"display_login":"seibert"}}