Skip to content
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

fix import error when matplotlib is not installed #2780

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

seeM
Copy link
Contributor

@seeM seeM commented Apr 16, 2024

@seeM seeM requested a review from petetronic April 16, 2024 19:55
@@ -27,7 +28,6 @@
from .data_explorer import DataExplorerService
from .help import HelpService, help
from .lsp import LSPService
from .matplotlib_backend import enable_positron_matplotlib_backend
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was that we were importing matplotlib_backend here, and it was importing matplotlib with no try-catch. The approach in this PR is to never import matplotlib_backend, and only ever let it be imported by matplotlib by setting the MPLBACKEND environment variable. That's the same approach IPython takes with the matplotlib-inline backend.

@petetronic
Copy link
Collaborator

I created a venv, installed ipykernel and was now able to start and use it as a python runtime for Positron without installing matplotlib.

@petetronic petetronic merged commit f230f47 into main Apr 16, 2024
24 checks passed
@petetronic petetronic deleted the fix-matplotlib-import branch April 16, 2024 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants