问题
I am dockerising the flask application on windows10 machine.I get the below error after the docker run
RuntimeError: cannot cache function '__jaccard': no locator available for file '/usr/local/lib/python3.7/site-packages/librosa/util/matching.py'
The flask application runs fine locally on my machine.
i referred to kind of similar post: numba caching issue: cannot cache function / no locator available for file
i have added the user access permissions for the application in the Dockerfile.
1. Dockerfile
FROM python:3.7.3
RUN useradd admin
COPY . /app
WORKDIR /app
RUN pip install -r "requirements.txt"
RUN chown -R admin:admin /app
RUN chmod 755 /app
USER admin
ENTRYPOINT ["python"]
CMD ["app.py"]
2. requirements.txt
flask
tensorflow
flask_cors
uuid
librosa
numba
pysoundfile
numpy
cffi
requests
wave
h5py
pydub
werkzeug
3. Error log:
Traceback (most recent call last):
File "app.py", line 6, in <module>
import librosa
File "/usr/local/lib/python3.7/site-packages/librosa/__init__.py", line 13, in <module>
from . import core
File "/usr/local/lib/python3.7/site-packages/librosa/core/__init__.py", line 114, in <module>
from .time_frequency import * # pylint: disable=wildcard-import
File "/usr/local/lib/python3.7/site-packages/librosa/core/time_frequency.py", line 10, in <module>
from ..util.exceptions import ParameterError
File "/usr/local/lib/python3.7/site-packages/librosa/util/__init__.py", line 70, in <module>
from .matching import * # pylint: disable=wildcard-import
File "/usr/local/lib/python3.7/site-packages/librosa/util/matching.py", line 16, in <module>
@numba.jit(nopython=True, cache=True)
File "/usr/local/lib/python3.7/site-packages/numba/decorators.py", line 179, in wrapper
disp.enable_caching()
File "/usr/local/lib/python3.7/site-packages/numba/dispatcher.py", line 571, in enable_caching
self._cache = FunctionCache(self.py_func)
File "/usr/local/lib/python3.7/site-packages/numba/caching.py", line 614, in __init__
self._impl = self._impl_class(py_func)
File "/usr/local/lib/python3.7/site-packages/numba/caching.py", line 349, in __init__
"for file %r" % (qualname, source_path))
RuntimeError: cannot cache function '__jaccard': no locator available for file '/usr/local/lib/python3.7/site-packages/librosa/util/matching.py'
回答1:
I've solved the problem by installing old version.
pip install librosa==0.6.0
来源:https://stackoverflow.com/questions/56995232/runtimeerror-cannot-cache-function-jaccard-no-locator-available-for-file