I'm having a lot of difficulty installing matplotlib in my pipenv, I believe due to the non-python dependencies.
The error I am getting is
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.
This is on MacOS X (High Sierra). I have installed libpng
freetype
and pkg-config
via brew, but this does not seem to resolve the issue.
My hope for this pipenv is for it to be deployed to Heroku, if that makes any difference.
Matplotlib 2.0. x supports Python versions 2.7 through 3.10.
To verify that Matplotlib is installed, try to invoke Matplotlib's version at the Python REPL. Use the commands below that include calling the . __version__ an attribute common to most Python packages.
Install matplotlib by entering its name into the search field and then selecting the Run command: pip install matplotlib option. Running the command will install matplotlib , and any packages it depends on (in this case that includes numpy ). Choose the Packages tab. Consent to elevation if prompted to do so.
Before trying as @brian suggested, for me, it worked by just adding matplotlib.use('TkAgg')
after import matplotlib
and before from matplotlib import pyplot
import matplotlib
matplotlib.use('TkAgg')
from matplotlib import pyplot
I resolved this error by following the instructions in this answer while also using this document to find where the matplotlibrc
file is located.
To do this inside my pipenv I ran the following code:
python
>>> import matplotlib
>>> matplotlib.matplotlib_fname()
Using the output I navigated to the matplotlibrc file within my virtual environment and added backend: TkAgg
to the file.
This resolved my issue. Hopefully this question can be of help to others!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With