Reputation: 2302
I am running on Mac 10.14.6 and all the solutions I've tried so far have not worked. I am following the docs for OpenAI spinningup and am stuck on this line:
python -m spinup.run plot data/installtest/installtest_s0
While trying to import matplotlib and plot some graphs however I keep getting:
File /anaconda3/envs/spinningup2/lib/python3.6/site-packages/matplotlib/backends/backend_macosx.py", line 14, in from matplotlib.backends import _macosx ImportError: 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.
Upon some searching online I see that this is quite a common problem so here is what I have tried so far:
1. https://github.com/scikit-optimize/scikit-optimize/issues/637
Added
import matplotlib
matplotlib.use('PS')
before importing matplotlib.pyplot
I still have the same error.
Instead of from matplotlib import pyplot as plt
I used:
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
However I still get the same error.
3. matplotlib: RuntimeError: Python is not installed as a framework
Add a line:
backend: TkAgg
in file:
~/.matplotlib/matplotlibrc
This does not solve my issue and I have the same error
4.
I try to create a file at ~/.matplotlib/matplotlibrc and populating it with the following text:
$ cat ~/.matplotlib/matplotlibrc
backend: TkAgg
When using the cat
command, this somehow crashes my MAC and causes a restart. I am very confused.
Any help or suggestions would be greatly appreciated. I've tried all suggestions I have found on this site with no luck.
Upvotes: 0
Views: 922
Reputation: 74
I was able to resolve the issue by uninstalling matplotlib, then reinstalling the exact version I needed (happens to be 3.0.3) using Conda.
I also note that Conda installed six (six-1.15.0-py37hecd8cb5_0) as part of this, so not sure what the culprit was but it is fixed now.
Upvotes: 1