I wanted to install Matplotlib in Mac (10.7.5 Lion) where python (2.7.1), pip (8.1.2), numpy (1.11.0), astropy(1.2) are already installed and are working as expected. First I tried with the command
sudo pip install matpltlib
and it showed that Matplotlib 1.5.1 has been installed successfully. But when I entered python and typed import matplotlib
it showed an error message like this:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/matplotlib/__init__.py", line 1131, in <module>
rcParams = rc_params()
File "/Library/Python/2.7/site-packages/matplotlib/__init__.py", line 975, in rc_params
return rc_params_from_file(fname, fail_on_error)
File "/Library/Python/2.7/site-packages/matplotlib/__init__.py", line 1100, in rc_params_from_file
config_from_file = _rc_params_in_file(fname, fail_on_error)
File "/Library/Python/2.7/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file
with _open_file_or_url(fname) as fd:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
return self.gen.next()
File "/Library/Python/2.7/site-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url
encoding = locale.getdefaultlocale()[1]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 496, in getdefaultlocale
return _parse_localename(localename)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 428, in _parse_localename
raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: UTF-8
I do not understand what exactly the problem is. I have opened all those .py files and have read the commands in lines specified. Since these are read-only files (even from root) nothing can be edited. I do not know how to resolve this.
Well, I then uninstalled it by pip, and tried to install from source.When I try to build it through python setup.py build
(after downloading 280 MB source file) it ends up will several errors like this-
src/_macosx.m:2494: warning: implicit conversion shortens 64-bit value into a 32-bit value
src/_macosx.m:1337: error: ‘for’ loop initial declaration used outside C99 mode
lipo: can't open input file: /var/folders/ks/31hhg2hj3273tbk2xwbjfv2h0000gn/T//ccEOsZZ4.out (No such file or directory)
lipo: can't open input file: /var/tmp//ccLauouU.out (No such file or directory)
error: command 'llvm-gcc-4.2' failed with exit status 1
I checked, there is no directory called var. I cannot debug this anymore.