-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: Permission denied when importing matplotlib.pyplot #28538
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The error is that you don't have permission to create |
Agree that this is a permissions issue and you should sort out why a process running as your user can not create the lock file. I would try removing matplotlib/lib/matplotlib/__init__.py Lines 520 to 534 in 6b7b999
is how we are currently checking that we can write to the cache directory. That said, we do have the behavior that if the config directory is not writable we skip writing and continue on. matplotlib/lib/matplotlib/font_manager.py Lines 968 to 972 in 6b7b999
We are being careful about the json writing failing, but not careful about the lock failing! |
Dear WeatherGod and tacaswell, Actually, when I bumped into that import problem, I had tried to figure it out by reinstall my Anaconda and Python, therefor I remove both of them through the "Uninstall or change a program" of "Control panel". A lot of thanks for your great suggestions. I will try it! Thank you! |
It is highly unlikely that the installation and uninstallation problems
have anything to do with the permission issues.
…On Thu, Jul 11, 2024 at 12:24 PM JCisCS ***@***.***> wrote:
The error is that you don't have permission to create
C:\Users\J\.matplotlib\fontlist-v330.json.matplotlib-lock. This is
unusual, but I doubt there is a bug in matplotlib. You need to see what the
permissions are for the C:\Users\J\.matplotlib\ folder. I am assuming
that you are logged in as the user J?
Dear WeatherGod and tacaswell,
Thank you so much for your suggestion.
Yes, I am login as "J".
I will try what your suggestions to see whether it can be resolved or not.
Actually, when I bumped into that import problem, I had tried to figure it
out by reinstall my Anaconda and Python, therefor I remove both of them
through the "Uninstall or change a program" of "Control panel".
After the removing, I did the re-install of Anaconda. But one message is
shown up as:
"A version of Python 3.12(64-bit) is alreadt at C:\Program
Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.O_x64_qbz5n2kfra8pO
We recommend that if you want Anaconda3 registered as your system Python,
you unregister this Python first. If you really know this is what you want,
click OK, otherwise click cancel to continue."
Therefor, I went back to check the existence of Python form the "Uninstall
or change a program" , but there is nothing left.
Then, I tried to reach the Python 3.12 mentioned in the above message to
remove it. But I was prohibited from accessing the C:\Program Files.
So I went back to the Anaconda installation and finish it.
After that, I checked the versions of Anaconda, Python. Open the jupyter
notebook and type the "import matplotlib.pyplot as plt" and run it, and,
the Denied Message shown it self again to me.
I am wondering whether this event being related with this import denied
problem since before that, the use of jupyter and importing of
matplotlib.pyplot were smooth.
A lot of thanks for your great suggestions. I will try it! Thank you!
—
Reply to this email directly, view it on GitHub
<#28538 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6CSFKKV7AT5QNNLS7LZL2WUFAVCNFSM6AAAAABKWUVYHWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTGM3DGNBRGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I'm going to re-open this as we should not be failing to import due to failure to write the cache. |
The locker works by writing a file to disk. This can also fail so make sure we can still import in that case. Closes matplotlib#28538
The locker works by writing a file to disk. This can also fail so make sure we can still import in that case. Closes matplotlib#28538
Dear tacaswell, And thank you too, WeatherGod! |
I see the same bug, and don't think #28541 is enough. The try is moved up to include cbook._lock_path call, but it also need to catch TimeoutError (raised in matplotlib/lib/matplotlib/cbook.py Line 1845 in 3b54c6a
|
@mrmathematica Under what conditions do you get the timeout error when it is correct to ignore the error? In the case of |
Bug summary
Once I type " import matplotlib.pyplot as plt" and run it, jupyter always returns:
"Matplotlib is building the font cache; this may take a moment."
#Then the return messages will end up as :
"PermissionError: [Errno 13] Permission denied: 'C:\Users\J\.matplotlib\fontlist-v330.json.matplotlib-lock'
And the functions of matplotlib.pyplot can not be excuted.
Code for reproduction
Actual outcome
Operating system
Windows
Matplotlib Version
matplotlib 3.8.4
Matplotlib Backend
matplotlib-inline 0.1.6
Python version
Python 3.12.3
Jupyter version
Jupyter 7.0.8
Installation
conda
[TAC edited to add markup]
The text was updated successfully, but these errors were encountered: