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

Problems importing matplotlib in a virtualenv on OSX #8

Closed
smacleod opened this issue May 28, 2016 · 2 comments
Closed

Problems importing matplotlib in a virtualenv on OSX #8

smacleod opened this issue May 28, 2016 · 2 comments

Comments

@smacleod
Copy link

I was having problems running the first cell of the notebooks due to a problem importing matplotlib

Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework

I solved this by creating a ~/.matplotlib/matplotlibrc file containing the line backend: TkAgg. Restarting jupyter notebook was also required.

@smacleod
Copy link
Author

Full traceback:


RuntimeError Traceback (most recent call last)
in ()
1 import networkx as nx
2 from datetime import datetime
----> 3 import matplotlib.pyplot as plt
4 import numpy as np
5 import warnings

/Users/smacleod/src/pycon2016-tutorials/Network-Analysis-Made-Simple/network/lib/python3.5/site-packages/matplotlib/pyplot.py in ()
112
113 from matplotlib.backends import pylab_setup
--> 114 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
115
116 _IP_REGISTERED = None

/Users/smacleod/src/pycon2016-tutorials/Network-Analysis-Made-Simple/network/lib/python3.5/site-packages/matplotlib/backends/init.py in pylab_setup()
30 # imports. 0 means only perform absolute imports.
31 backend_mod = import(backend_name,
---> 32 globals(),locals(),[backend_name],0)
33
34 # Things we pull in from all backends

/Users/smacleod/src/pycon2016-tutorials/Network-Analysis-Made-Simple/network/lib/python3.5/site-packages/matplotlib/backends/backend_macosx.py in ()
22
23 import matplotlib
---> 24 from matplotlib.backends import _macosx
25
26

RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are Working with Matplotlib in a virtual enviroment see 'Working with Matplotlib in Virtual environments' in the Matplotlib FAQ

@ericmjl
Copy link
Owner

ericmjl commented May 28, 2016

Thanks @smacleod! I will close this issue, but reference it in the README in case future participants encounter the same issue.

@ericmjl ericmjl closed this as completed May 28, 2016
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

No branches or pull requests

2 participants