Permission denied: '/root/.cache/matplotlib/fontlist-v330.json.matplotlib-lock #1289
-
I'm getting a Permission denied error for a "matplotlib-lock" when importing the library "Supervision". Im using the manifest file and makefile from the CI-Example/Python folder. I've tried using GSC but the issue persists. Code: import supervision as sv Output: Matplotlib is building the font cache; this may take a moment.
Traceback (most recent call last):
File "main.py", line 3, in <module>
import supervision as sv
File "/usr/local/lib/python3.8/dist-packages/supervision/__init__.py", line 11, in <module>
from supervision.notebook.utils import show_frame_in_notebook
File "/usr/local/lib/python3.8/dist-packages/supervision/notebook/utils.py", line 4, in <module>
import matplotlib.pyplot as plt
File "/usr/local/lib/python3.8/dist-packages/matplotlib/pyplot.py", line 52, in <module>
import matplotlib.colorbar
File "/usr/local/lib/python3.8/dist-packages/matplotlib/colorbar.py", line 19, in <module>
from matplotlib import _api, cbook, collections, cm, colors, contour, ticker
File "/usr/local/lib/python3.8/dist-packages/matplotlib/contour.py", line 13, in <module>
from matplotlib.backend_bases import MouseButton
File "/usr/local/lib/python3.8/dist-packages/matplotlib/backend_bases.py", line 45, in <module>
from matplotlib import (
File "/usr/local/lib/python3.8/dist-packages/matplotlib/text.py", line 16, in <module>
from .font_manager import FontProperties
File "/usr/local/lib/python3.8/dist-packages/matplotlib/font_manager.py", line 1548, in <module>
fontManager = _load_fontmanager()
File "/usr/local/lib/python3.8/dist-packages/matplotlib/font_manager.py", line 1543, in _load_fontmanager
json_dump(fm, fm_path)
File "/usr/local/lib/python3.8/dist-packages/matplotlib/font_manager.py", line 957, in json_dump
with cbook._lock_path(filename), open(filename, 'w') as fh:
File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.8/dist-packages/matplotlib/cbook/__init__.py", line 1804, in _lock_path
with lock_path.open("xb"):
File "/usr/lib/python3.8/pathlib.py", line 1222, in open
return io.open(self, mode, buffering, encoding, errors, newline,
File "/usr/lib/python3.8/pathlib.py", line 1078, in _opener
return self._accessor.open(self, flags, mode)
PermissionError: [Errno 13] Permission denied: '/root/.cache/matplotlib/fontlist-v330.json.matplotlib-lock' Any ideas? |
Beta Was this translation helpful? Give feedback.
Answered by
rodrigo-pedro
Apr 16, 2023
Replies: 1 comment
-
Ok i managed to fix this. Since I already have /tmp mounted in fs.mount, I changed the cache folder for matplotlib to a folder in /tmp with the following line: os.environ['MPLCONFIGDIR'] = '/tmp/.cache' Make sure to add this line before importing the library that is causing the issue. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
rodrigo-pedro
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok i managed to fix this. Since I already have /tmp mounted in fs.mount, I changed the cache folder for matplotlib to a folder in /tmp with the following line:
Make sure to add this line before importing the library that is causing the issue.