本文介绍了RuntimeError:无法缓存函数“ __jaccard”:文件“ /usr/local/lib/python3.7/site-packages/librosa/util/matching.py”没有可用的定位器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在docker Windows10计算机上的flask应用程序。在docker运行后出现以下错误

I am dockerising the flask application on windows10 machine.I get the below error after the docker run

RuntimeError:无法缓存函数'__jaccard':no定位器可用于文件'/usr/local/lib/python3.7/site-packages/librosa/util/matching.py'

flask应用程序

我指的是类似的帖子:

i referred to kind of similar post: numba caching issue: cannot cache function / no locator available for file

我已在Dockerfile中添加了该应用程序的用户访问权限。

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。错误日志:

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'


推荐答案

我已经通过安装旧版本解决了该问题。

I've solved the problem by installing old version.

pip install librosa==0.6.0

这篇关于RuntimeError:无法缓存函数“ __jaccard”:文件“ /usr/local/lib/python3.7/site-packages/librosa/util/matching.py”没有可用的定位器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 11:48