numba caching issue: cannot cache function / no locator available for file

柔情痞子 提交于 2020-01-03 17:34:09

问题


I am trying to deploy a codebase that has a number numba.njit functions with cache=True.

It works fine running locally (Mac OS X 10.12.3), but on the remote machine (Ubuntu 14.04 on AWS) I am getting the following error:

RuntimeError at /portal/

cannot cache function 'filter_selection': 

no locator available for file:
'/srv/run/miniconda/envs/mbenv/lib/python2.7/site-packages/mproj/core_calcs/filter.py'

I looked through the numba codebase, and I saw this file: https://github.com/numba/numba/blob/master/numba/caching.py

It appears that the following function is returning None instead of a locator, for this exception to be raised

cls.from_function(py_func, source_path)

Guessing this is a permission to write the pycache folders, but I didn't see in the numba docs a way to specify the cache folder location (CACHE_DIR).

Has anyone hit this before, and if so, what is the suggested work-around?


回答1:


Set sys.frozen = True before for cls in self._locator_classes: in caching.py can eliminate the issue.

I have no idea whether such setting will impact performance.



来源:https://stackoverflow.com/questions/44183779/numba-caching-issue-cannot-cache-function-no-locator-available-for-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!