{"action":"created","issue":{"url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/51","labels_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/51/labels{/name}","comments_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/51/comments","events_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/51/events","html_url":"https://github.com/arrayfire/arrayfire-python/issues/51","id":122075313,"number":51,"title":"Better error checking during initialization ","user":{"login":"FilipeMaia","id":147838,"avatar_url":"https://avatars.githubusercontent.com/u/147838?v=3","gravatar_id":"","url":"https://api.github.com/users/FilipeMaia","html_url":"https://github.com/FilipeMaia","followers_url":"https://api.github.com/users/FilipeMaia/followers","following_url":"https://api.github.com/users/FilipeMaia/following{/other_user}","gists_url":"https://api.github.com/users/FilipeMaia/gists{/gist_id}","starred_url":"https://api.github.com/users/FilipeMaia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FilipeMaia/subscriptions","organizations_url":"https://api.github.com/users/FilipeMaia/orgs","repos_url":"https://api.github.com/users/FilipeMaia/repos","events_url":"https://api.github.com/users/FilipeMaia/events{/privacy}","received_events_url":"https://api.github.com/users/FilipeMaia/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-14T16:14:42Z","updated_at":"2015-12-16T15:40:36Z","closed_at":null,"body":"Today I came across the following cryptic error message when trying to use arrayfire-python:\r\n\r\n```python\r\n\r\nIn [1]: import arrayfire\r\nIn [2]: arrayfire.backend.name()\r\nOut[2]: 'cuda'\r\nIn [5]: arrayfire.Array()\r\n---------------------------------------------------------------------------\r\nRuntimeError                              Traceback (most recent call last)\r\n<ipython-input-5-6dffbbbc7abd> in <module>()\r\n----> 1 arrayfire.Array()\r\n\r\n/home/filipe/.local/lib/python2.7/site-packages/arrayfire-3.2.20151211-py2.7.egg/arrayfire/array.pyc in __init__(self, src, dims, dtype, is_device)\r\n    422             for n in range(numdims):\r\n    423                 idims[n] = dims[n]\r\n--> 424             self.arr = _create_empty_array(numdims, idims, to_dtype[type_char])\r\n    425\r\n    426     def as_type(self, ty):\r\n\r\n/home/filipe/.local/lib/python2.7/site-packages/arrayfire-3.2.20151211-py2.7.egg/arrayfire/array.pyc in _create_empty_array(numdims, idims, dtype)\r\n     36     c_dims = dim4(idims[0], idims[1], idims[2], idims[3])\r\n     37     safe_call(backend.get().af_create_handle(ct.pointer(out_arr),\r\n---> 38                                              numdims, ct.pointer(c_dims), dtype.value))\r\n     39     return out_arr\r\n     40\r\n\r\n/home/filipe/.local/lib/python2.7/site-packages/arrayfire-3.2.20151211-py2.7.egg/arrayfire/util.pyc in safe_call(af_error)\r\n     73         err_len = ct.c_longlong(0)\r\n     74         backend.get().af_get_last_error(ct.pointer(err_str), ct.pointer(err_len))\r\n---> 75         raise RuntimeError(to_str(err_str), af_error)\r\n     76\r\n     77 def get_version():\r\n\r\nRuntimeError: ('Error in /var/lib/jenkins-slave/workspace/arrayfire-linux-mkl-graphics-installer/src/api/c/data.cpp(197):\\n\\n\\n', 998)\r\n```\r\n\r\nThe error was caused by a bad driver version:\r\n\r\n```shell\r\n$ nvidia-smi\r\nFailed to initialize NVML: GPU access blocked by the operating system\r\n```\r\n\r\nI think it could be useful if arrayfire would test if a device is really available, instead of just checking if it can dlopen the relevant library. For example by calling `arrayfire.Array()`. If that would fail a more useful error could be returned to the user."},"comment":{"url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/comments/165147954","html_url":"https://github.com/arrayfire/arrayfire-python/issues/51#issuecomment-165147954","issue_url":"https://api.github.com/repos/arrayfire/arrayfire-python/issues/51","id":165147954,"user":{"login":"PythonProdigy","id":16299511,"avatar_url":"https://avatars.githubusercontent.com/u/16299511?v=3","gravatar_id":"","url":"https://api.github.com/users/PythonProdigy","html_url":"https://github.com/PythonProdigy","followers_url":"https://api.github.com/users/PythonProdigy/followers","following_url":"https://api.github.com/users/PythonProdigy/following{/other_user}","gists_url":"https://api.github.com/users/PythonProdigy/gists{/gist_id}","starred_url":"https://api.github.com/users/PythonProdigy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PythonProdigy/subscriptions","organizations_url":"https://api.github.com/users/PythonProdigy/orgs","repos_url":"https://api.github.com/users/PythonProdigy/repos","events_url":"https://api.github.com/users/PythonProdigy/events{/privacy}","received_events_url":"https://api.github.com/users/PythonProdigy/received_events","type":"User","site_admin":false},"created_at":"2015-12-16T15:40:36Z","updated_at":"2015-12-16T15:40:36Z","body":"Ah, the woes of package managers! It's hard to cover all of the bases but this disappointing news is very hard to hear. I have never been a fan of yum and the way it handles packages, but mediocrity often finds safety in standardization..."}}