{"action":"created","issue":{"url":"https://api.github.com/repos/pyopencl/pyopencl/issues/97","labels_url":"https://api.github.com/repos/pyopencl/pyopencl/issues/97/labels{/name}","comments_url":"https://api.github.com/repos/pyopencl/pyopencl/issues/97/comments","events_url":"https://api.github.com/repos/pyopencl/pyopencl/issues/97/events","html_url":"https://github.com/pyopencl/pyopencl/issues/97","id":116541647,"number":97,"title":"Impossible to explicitly choose cache_dir","user":{"login":"PolarNick239","id":1218605,"avatar_url":"https://avatars.githubusercontent.com/u/1218605?v=3","gravatar_id":"","url":"https://api.github.com/users/PolarNick239","html_url":"https://github.com/PolarNick239","followers_url":"https://api.github.com/users/PolarNick239/followers","following_url":"https://api.github.com/users/PolarNick239/following{/other_user}","gists_url":"https://api.github.com/users/PolarNick239/gists{/gist_id}","starred_url":"https://api.github.com/users/PolarNick239/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolarNick239/subscriptions","organizations_url":"https://api.github.com/users/PolarNick239/orgs","repos_url":"https://api.github.com/users/PolarNick239/repos","events_url":"https://api.github.com/users/PolarNick239/events{/privacy}","received_events_url":"https://api.github.com/users/PolarNick239/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-11-12T12:38:40Z","updated_at":"2015-11-12T19:56:17Z","closed_at":null,"body":"Use case:\r\n`cl.array.zeros(cl_queue, (h, w, 2), np.float32)`\r\nException:\r\n`PermissionError: [Errno 13] Permission denied: '/.cache'`\r\n\r\nPyOpenCL will implicitly use as cache dir `os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache'))`, but my server is a daemon, so $HOME is empty, so it tries to use '/.cache' directory, but of course it has no rights, and so it fails. \r\n(`cache_dir = join(appdirs.user_cache_dir(\"pyopencl\", \"pyopencl\"),` https://github.com/pyopencl/pyopencl/blob/master/pyopencl/cache.py#L345)\r\n\r\n**Suggestion**: provide possibility to choose cache dir explicitly. May be the best way is not `Program.build(..., cache_dir)`, but make cache_dir be an optional property of context? Because it is impossible to configure cache_dir for such places: \r\n(`return Program(context, source).build(options)` https://github.com/pyopencl/pyopencl/blob/master/pyopencl/elementwise.py#L111)\r\n\r\n**Workaround**:\r\n`export XDG_CACHE_HOME=\"/home/<user_name>/.cache\"`"},"comment":{"url":"https://api.github.com/repos/pyopencl/pyopencl/issues/comments/156217151","html_url":"https://github.com/pyopencl/pyopencl/issues/97#issuecomment-156217151","issue_url":"https://api.github.com/repos/pyopencl/pyopencl/issues/97","id":156217151,"user":{"login":"PolarNick239","id":1218605,"avatar_url":"https://avatars.githubusercontent.com/u/1218605?v=3","gravatar_id":"","url":"https://api.github.com/users/PolarNick239","html_url":"https://github.com/PolarNick239","followers_url":"https://api.github.com/users/PolarNick239/followers","following_url":"https://api.github.com/users/PolarNick239/following{/other_user}","gists_url":"https://api.github.com/users/PolarNick239/gists{/gist_id}","starred_url":"https://api.github.com/users/PolarNick239/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolarNick239/subscriptions","organizations_url":"https://api.github.com/users/PolarNick239/orgs","repos_url":"https://api.github.com/users/PolarNick239/repos","events_url":"https://api.github.com/users/PolarNick239/events{/privacy}","received_events_url":"https://api.github.com/users/PolarNick239/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T19:56:16Z","updated_at":"2015-11-12T19:56:16Z","body":"Yes, but not very soon - in a couple of weeks."}}