Unable to “import matplotlib.pyplot as plt” in virtualenv
(PyMVPA) SimilarFacedeMacBook-Pro:PyMVPA similarface$ pip install matplotlib
Collecting matplotlib
Downloading matplotlib-2.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (13.2MB)
100% |████████████████████████████████| 13.2MB 18kB/s
Collecting pytz (from matplotlib)
Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
100% |████████████████████████████████| 512kB 3.8kB/s
Collecting six>=1.10 (from matplotlib)
Downloading six-1.11.0-py2.py3-none-any.whl
Collecting backports.functools-lru-cache (from matplotlib)
Downloading backports.functools_lru_cache-1.4-py2.py3-none-any.whl
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
Using cached pyparsing-2.2.0-py2.py3-none-any.whl
Requirement already satisfied: numpy>=1.7.1 in ./lib/python2.7/site-packages (from matplotlib)
Collecting python-dateutil>=2.0 (from matplotlib)
Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 70kB/s
Collecting cycler>=0.10 (from matplotlib)
Using cached cycler-0.10.0-py2.py3-none-any.whl
Collecting subprocess32 (from matplotlib)
Downloading subprocess32-3.2.7.tar.gz (54kB)
100% |████████████████████████████████| 61kB 46kB/s
Building wheels for collected packages: subprocess32
Running setup.py bdist_wheel for subprocess32 ... done
Stored in directory: /Users/similarface/Library/Caches/pip/wheels/7d/4c/a4/ce9ceb463dae01f4b95e670abd9afc8d65a45f38012f8030cc
Successfully built subprocess32
Installing collected packages: pytz, six, backports.functools-lru-cache, pyparsing, python-dateutil, cycler, subprocess32, matplotlib
Successfully installed backports.functools-lru-cache-1.4 cycler-0.10.0 matplotlib-2.1.0 pyparsing-2.2.0 python-dateutil-2.6.1 pytz-2017.3 six-1.11.0 subprocess32-3.2.7
(PyMVPA) SimilarFacedeMacBook-Pro:PyMVPA similarface$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import pylab
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/pylab.py", line 257, in <module>
from matplotlib import cbook, mlab, pyplot as plt
File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/pyplot.py", line 113, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 60, in pylab_setup
[backend_name], 0)
File "/Users/similarface/virtualenvs/PyMVPA/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 19, in <module>
from matplotlib.backends import _macosx
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 using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.
>>>
(PyMVPA) SimilarFacedeMacBook-Pro:PyMVPA similarface$ cd ~/.matplotlib/
(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ vi matplotlibrc
(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ cat matplotlibrc
backend: TkAgg
(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$ python
Python 2.7.10 (default, Jul 14 2015, 19:46:27)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from matplotlib import pylab
>>> ^D
(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$
(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$
(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$
(PyMVPA) SimilarFacedeMacBook-Pro:.matplotlib similarface$