Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

numba

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?

like image 463
Greg Jennings Avatar asked May 25 '17 15:05

Greg Jennings


1 Answers

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.

like image 138
slw287r Avatar answered Sep 28 '22 00:09

slw287r