问题
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